Announcement Announcement Module
Collapse
No announcement yet.
spring-integration 2.0+Batch+retryploicy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring-integration 2.0+Batch+retryploicy

    Hi All,

    my environment consists of SI 2.0,Spring-batch-infrastructure 2.1.8,spring-aop 3.0

    use case is jms:outbound-channel-adapter should try to some more attempts to deliver the message in case of queue is full or any type of jmsException.

    <bean id="jmsOutBoundRetryInterceptor"
    class="org.springframework.batch.retry.interceptor .RetryOperationsInterceptor">
    <property name="retryOperations">
    <bean class="org.springframework.batch.retry.support.Ret ryTemplate">
    <property name="retryPolicy">
    <bean class="org.springframework.batch.retry.policy.Exce ptionClassifierRetryPolicy">
    <property name="policyMap">
    <map>
    <entry key="org.springframework.integration.MessagingExce ption">
    <bean class="org.springframework.batch.retry.policy.Simp leRetryPolicy">
    <property name="maxAttempts" value="5" />
    </bean>
    </entry>
    </map>
    </property>
    </bean>
    </property>
    <property name="backOffPolicy">
    <bean class="org.springframework.batch.retry.backoff.Fix edBackOffPolicy">
    <property name="backOffPeriod" value="3000" />
    </bean>
    </property>
    </bean>
    </property>
    </bean>


    <aop:config>
    <aop:advisor pointcut="execution(* org.springframework.integration.jms.JmsSendingMess ageHandler.*())"
    advice-ref="jmsOutBoundRetryInterceptor" />
    </aop:config>

    advice is woven to all the methods of JmsSendingMessageHandler class
    please find the log show shows that the proxy class is created for the JmsSendingMessageHandler and advice is woven to that.

    2011-11-21 07:01:16,361|DEBUG|org.springframework.jndi.JndiTe mplate|Looking up JNDI object with name [CI.EVEN.SUB]
    2011-11-21 07:01:16,361|DEBUG|org.springframework.jndi.JndiOb jectFactoryBean|Located object with JNDI name [CI.EVEN.SUB]
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Finished creating instance of bean 's1.destination'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 's1.tibJMSHeaderMapper'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Invoking afterPropertiesSet() on bean with name 'org.springframework.integration.jms.JmsSendingMes sageHandler#1'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,361|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.aop.aspectj .autoproxy.AspectJAwareAdvisorAutoProxyCreator|Cre ating implicit proxy for bean 'org.springframework.integration.jms.JmsSendingMes sageHandler#1' with 0 common interceptors and 2 specific interceptors
    2011-11-21 07:01:16,376|DEBUG|org.springframework.aop.framewo rk.JdkDynamicAopProxy|Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [org.springframework.integration.jms.JmsSendingMess ageHandler@1443800]
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Finished creating instance of bean 'org.springframework.integration.jms.JmsSendingMes sageHandler#1'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Creating shared instance of singleton bean 's1.outJms'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Creating instance of bean 's1.outJms'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Eagerly caching bean 's1.outJms' to allow for resolving potential circular references
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.integration.jms.JmsSendingMes sageHandler#1'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Invoking afterPropertiesSet() on bean with name 's1.outJms'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 's1.outChannel'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactor yPointcutAdvisor#0'
    2011-11-21 07:01:16,376|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Finished creating instance of bean 's1.outJms'

    for testing i set the destination queue max message to 1 so that my application should retry once the queue is full.

    problem is my application is not attempting for retry once the destination is full ,messages are going to error channel
    without retry attempt

    please find the log

    2011-11-21 07:26:31,777|DEBUG|org.springframework.integration .channel.DirectChannel|preSend on channel 's3.outChannel', message: [Payload=<payload><number>4</number></payload>][Headers={PublisherMsgId=7b32a9a0-1bc6-4ad8-918a-a839e72fd202, errorChannel=s3.exception.channel, EEB_Channel=s3.inChannel,SubscriberMsgId=e9ba9004-2fc3-4857-ae73-bbc3ed98b6af,id=301c492c-ec2a-487f-9a3a-ffffeb626d2b, timestamp=1321881991761, SUB_Destination=CI.EVEN.F.4.SUB}]
    2011-11-21 07:26:31,777|DEBUG|org.springframework.integration .jms.JmsSendingMessageHandler|org.springframework. integration.jms.JmsSendingMessageHandler#5 received message: [Payload=<payload><number>4</number></payload>][Headers={PublisherMsgId=7b32a9a0-1bc6-4ad8-918a-a839e72fd202, errorChannel=s3.exception.channel, EEB_Channel=s3.inChannel,SubscriberMsgId=e9ba9004-2fc3-4857-ae73-bbc3ed98b6af,id=301c492c-ec2a-487f-9a3a-ffffeb626d2b, timestamp=1321881991761, SUB_Destination=CI.EVEN.F.4.SUB}]
    2011-11-21 07:26:31,792|INFO|org.springframework.jms.connecti on.CachingConnectionFactory|Established shared JMS Connection: QueueConnection[ClientId=eeb.cn=CI.EVEN.F.4.SUB,ou=uprr,o=up.local host Connected=tcp://localhost:7222, URL=tcp://localhost:7222,tcp://localhost:7224]
    2011-11-21 07:26:31,792|DEBUG|org.springframework.jms.connect ion.CachingConnectionFactory|Creating cached JMS Session for mode 1: com.tibco.tibjms.TibjmsxSessionImp@fa1b2d
    2011-11-21 07:26:31,792|DEBUG|org.springframework.integration .jms.DynamicJmsTemplate|Executing callback on JMS Session: Cached JMS Session: com.tibco.tibjms.TibjmsxSessionImp@fa1b2d
    2011-11-21 07:26:31,792|DEBUG|org.springframework.jms.connect ion.CachingConnectionFactory|Creating cached JMS MessageProducer for destination [Queue[CI.EVEN.F.4.SUB]]: QueueSender[queue=CI.EVEN.F.4.SUB]
    2011-11-21 07:26:31,792|DEBUG|org.springframework.integration .jms.DynamicJmsTemplate|Sending created message: TextMessage={ Header={ JMSMessageID={null} JMSDestination={null} JMSReplyTo={null} JMSDeliveryMode={PERSISTENT} JMSRedelivered={false} JMSCorrelationID={null} JMSType={null} JMSTimestamp={0} JMSExpiration={0} JMSPriority={4} } Properties={ PublisherMsgId={String:7b32a9a0-1bc6-4ad8-918a-a839e72fd202} Topic={String:number/even} SubscriberMsgId={String:e9ba9004-2fc3-4857-ae73-bbc3ed98b6af} } Text={[Payload=<payload><number>4</number></payload>]}
    2011-11-21 07:26:31,808|DEBUG|org.springframework.beans.facto ry.support.DefaultListableBeanFactory|Returning cached instance of singleton bean 'errorChannel'
    2011-11-21 07:26:31,808|DEBUG|org.springframework.integration .channel.DirectChannel|preSend on channel 's3.exception.channel', message: [Payload=org.springframework.integration.MessageHan dlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMess ageHandler#5]][Headers={timestamp=1321881991808, id=d73435a6-c870-4fd2-9d8d-70eb2ecfbb1c}]

    when i checked the log in detail the retry advice is woven at the starting of some beans ,find the log below

    2011-11-21 07:26:27,730|DEBUG|org.springframework.context.sup port.DefaultLifecycleProcessor|Starting bean 's3.outJms' of type [class org.springframework.integration.config.ConsumerEnd pointFactoryBean]
    2011-11-21 07:26:27,730|DEBUG|org.springframework.batch.retry .support.RetryTemplate|Retry: count=0


    Thanks in Advance
    srinibas
Working...
X