Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Handling Failures With StatefulRetryOperationsInterceptorFactoryBean

  1. #11

    Default

    FYI I created a new branch of our "blueprint rabbitmq project" at CARFAX that illustrates using the StatefulRetryOperationsInterceptorFactoryBean to implement generic error handling.

    https://github.com/CARFAX/blueprint-...error-handling

    I'll try to follow this up with a blog post soon.

  2. #12
    Join Date
    Dec 2011
    Posts
    13

    Default xml config instead of annotation based

    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" />

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •