I'm trying to implement a retry/recover component using xml context configuration. As a guide, I started with the nice dead-letter Carfax example by James Carr on github. My goal is to retry a message twice if any exception is thrown during processing, then publish/send it to a differnt queue reserved for erroring messages. Maybe I should be using an inbound gateway instead of a channel? I don't know. Any advice is greatly appreciated.
Code:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sroi' defined in class path resource [spring_context.xml]: No matching factory method found: factory bean 'sroifb'; factory method 'getObject()'. Check that a method with the specified name exists and that it is non-static.
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:528)
Code:
<bean id="errQRecoverer" class="com.se.subscrip.consum.ErrorQueueMessageRecoverer"></bean>
<bean id="sroi" class="org.springframework.retry.interceptor.StatefulRetryOperationsInterceptor"
factory-bean="sroifb" factory-method="getObject" />
<bean id="rp" class="org.springframework.retry.policy.SimpleRetryPolicy">
<property name="maxAttempts" value="2" />
</bean>
<bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
<property name="retryPolicy" ref="rp" />
</bean>
<bean id="sroifb" class="org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean">
<property name="retryOperations" ref="retryTemplate" />
<property name="messageRecoverer" ref="errQRecoverer" />
</bean>
<amqp:inbound-channel-adapter queue-names="some.q.name.here" channel="chan1"
connection-factory="rabbitConnFactory" channel-transacted="true" concurrent-consumers="1" tx-size="1"
acknowledge-mode="AUTO" advice-chain="sroi" error-handler="ErrorHandlerBean" />