Message order after MDB rollback
jomu78 May 14, 2012 12:00 PMHi,
I am trying to asure the message order for all messages. I have read many topics in documenation and here in the community but it seems I missed something. All tests are running on Jboss 7.0.2 (preview, HornetQ 2.2.7)
As a producer I have a simple timer, which queues a message every fiew seconds - the text message includes current date. There is one MDB as consumer which tries to post the message to another server so I can to this server to simulate unavailibility.
The produces uses message grouping:
textMessage.setStringProperty("JMSXGroupID", "Group1");
The consumer MDB is limited to one
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")
The messaging system in Jboss 7.0.2 is set as follows
- persist = true
- redlivery-delay=30000
- max-delivery-attempts=-1
JMS Connection Factories, sender uses XAConnectionFactory at the moment, but ConnectionFactory showed the same result
<jms-connection-factories> <connection-factory name="InVmConnectionFactory"> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/ConnectionFactory"/> </entries> <consumer-window-size>0</consumer-window-size> </connection-factory> <connection-factory name="InVmConnectionFactoryXA"> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/XAConnectionFactory"/> </entries> <consumer-window-size>0</consumer-window-size> </connection-factory> <pooled-connection-factory name="hornetq-ra"> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/JmsXA"/> </entries> <transaction mode="xa"/> <consumer-window-size>0</consumer-window-size> </pooled-connection-factory> </jms-connection-factories>
From what I understood it would be ok to set consumer-window-size=0 for hornetq-ra only as the MDB as the only consumer uses this one - but anyway, it is not working.
If I shutdown the receiving server for a while, I can see in the logfile the server rolls back the transaction, as the message could not be posted. What confuses me a bit, that I see the log entries from the MDB when the timer created a new message even the first message in the queue could not be delivered and is waiting for the redelivery timer.
At the end when I check the log file (on JBoss and on the second server) I can see the timestamps are mixed. The first successful delivery (restart of server 2) was from 16:59:27,206 - the stdout is from the timer object.
16:59:29,251 INFO [JMSListenerMessageDrivenBean] (Thread-0 (group:HornetQ-client-global-threads-466366777)) Message sent successfully: Eventmessage created on Mon May 14 16:58:25 CEST 2012 16:59:30,220 INFO [stdout] (pool-5-thread-1) Message queued: Eventmessage created on Mon May 14 16:59:30 CEST 2012 16:59:30,220 INFO [JMSListenerMessageDrivenBean] (Thread-1 (group:HornetQ-client-global-threads-466366777)) Message sent successfully: Eventmessage created on Mon May 14 16:59:30 CEST 2012 16:59:32,125 INFO JMSListenerMessageDrivenBean] (Thread-0 (group:HornetQ-client-global-threads-466366777)) Message sent successfully: Eventmessage created on Mon May 14 16:59:00 CEST 2012 16:59:34,249 INFO JMSListenerMessageDrivenBean] (Thread-1 (group:HornetQ-client-global-threads-466366777)) Message sent successfully: Eventmessage created on Mon May 14 16:58:30 CEST 2012
The above logfiles show both issues I have found
1st: It seems as a newly created message from 16:59:30 (2nd line) is sent directly (line 3) instead of queing it first - so it bypassses the older messages.
2nd: the old messages themselfs are out of order, message from 16:59:00 (line 4) is sent before 16:58:30 (line 5).
The output on the receiving server shows the same message oder as in th Jboss log.
So in summary I have
- message groups which should asure messages are deliverd to same consumer
- only one MDB as a consumer on the queue
- disabled the cache on the connectors
What did I miss?
Regards
Joern