Announcement Announcement Module
No announcement yet.
Poller loosing messages Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Poller loosing messages

    Environment: Using spring integration 1.4, Spring (2.5.6), JDK 1.5.
    Problem: Loosing some messages in polling
    Flow: Order booked, paid. However poller seems to be loosing some orders when booked and paid concurrently. So if booking nearly 1000 orders, at the same time start paying for it.
    Could someone please point out what wrong I am doing?
    Note: The config works perfectly with small number of orders (say 10).

    	<bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
        	   <property name="connectionFactory" ref="jmsConnectionFactory" />
      	<tx:annotation-driven transaction-manager="transactionManager"/>
    	<integration:poller id="inPoller" default="true">
    		<integration:interval-trigger interval="60" fixed-rate="true"
    			time-unit="SECONDS" />
    		<integration:transactional transaction-manager="transactionManager" propagation="REQUIRED" />
    	<int-jms:inbound-channel-adapter id="jmsReportInBooked" connection-factory="jmsConnectionFactory" 
    			destination-resolver="jndiDestinationResolver" destination-name="reportEventQueue" 
    	<integration:channel id="eventChannel"/>
    	<integration:header-value-router input-channel="eventChannel" header-name="EVENT_TYPE">
    		<integration:mapping value="BOOKED" channel="bookedEventChannel"/>
    		<integration:mapping value="PAID" channel="paidEventChannel"/>
    	<integration:channel id="bookedEventChannel"/>
           <integration:service-activator input-channel="bookedEventChannel" ref="bookedEventMessageHandler" 
    	<integration:channel id="paidEventChannel"/>
    	<integration:service-activator input-channel="paidEventChannel" ref="paidEventMessageHandler" 
    Last edited by nit_mis; Nov 7th, 2012, 07:48 AM.

  • #2

    Looking at your configuration, I am having a few questions:

    Why are you using the polling JMS adapter, rather than a message-driven-channel-adapter? We would generally recommend using the Message-Driven Channel Adapter instead (Uses Spring's Message Listener Container -

    Using a Message Listener Container, messages will be passed along to the MessageChannel as soon as they are received from the underlying JMS consumer and thus, there is no need to do polling and you have more configuration options.

    Of course, you may have some very special requirements requiring you to have a low frequency polling interval or a cron expression for certain time windows where you expect messages, but typically you should use the Message Driven Channel Adapter.

    Also, what is the reason for you using a JMS transaction manager (JmsTransactionManager)? Local transactions typically work just fine, and the JMS session is bound to the thread, in case any exceptions are throw downstream. The external transaction manager is usually only needed if you want to use JTA.

    Lastly - You are using a very old version of Spring Integration and you probably should migrate as soon as possible. E.g. Spring Integration's 2.2.0 GA release is scheduled for next week.

    Also, what JMS provider are you using? Do you see any exceptions being raised? Are the JMS transactions successfully committed when processing "lost" messages? Are the messages showing up in any dead letter queue (DLQ)? Are you using JTA?




    • #3
      Thanks Gunnar Hillert for your reply. I see your reason for using Message channel adapter and looks perfectly valid and it resolves the issue as well. The reason for using JMSTransactionManager was, since in the spring integration version (1.4) default acknowledge="auto" (version 2.0 has default acknowledge="transacted") and strangely that does not roll back the transaction when an exception is thrown.
      Also I am fully with you using latest version of Spring Int. but as I mentioned that we have Spring 2.5.6 for the project, so we cannot move to Integration 2 as it needs atleast Spring version 3.0.
      Last edited by nit_mis; Nov 15th, 2012, 05:31 AM.