onMessage JMS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

onMessage JMS

Renato Eschini
I have some implementation of MessageListener configured with BTM - OracleAQ, but it not work correctly, I know.... it not commit the get of message and I cant' commit a publish of new message in the topic.

What is the correct flow to implement in right way onMessage listner?

I obtain XASession and subscribe the listner ... the start of (User)transaction in onMessage is implicit? and in which way I commit or rollback the (User)transaction ?

thanks all!

Reply | Threaded
Open this post in threaded view
|

Re: onMessage JMS

Renato Eschini

Renato Eschini wrote
I have some implementation of MessageListener configured with BTM - OracleAQ, but it not work correctly, I know.... it not commit the get of message and I cant' commit a publish of new message in the topic.

What is the correct flow to implement in right way onMessage listner?
The question is: does BTM-JTA support asynchronus message handling?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: onMessage JMS

Ludovic Orban
Administrator
Renato,

The short answer to your questions is: the only way to have asynchronous message handling with BTM is to use a Spring DefaultMessageListenerContainer (http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html) or equivalent.

In a nutshell, this is a class which starts a transaction, synchronously waits for a JMS message with a short timeout on the reception, rolls back the transaction if no message was read or send the message for processing to some worker when a message was read.

Polling the JMS container is the only portable way to get async messaging inside an XA transaction using only the JMS API. The onMessage() technique can't work because the JMS server would need a way to start a XA transaction after the message has been read. This technique was known as 'JMS Chapter 8' or 'ServerSessionPool stuff' but it proved to be unreliable, poorly specified and difficult to implement so this was dropped between J2EE 1.3 and J2EE 1.4 and replaced by JCA which offers this capability.

Reply | Threaded
Open this post in threaded view
|

Re: onMessage JMS

Renato Eschini

Ludovic Orban wrote
Renato,

The short answer to your questions is: the only way to have asynchronous message handling with BTM is to use a Spring DefaultMessageListenerContainer (http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html) or equivalent.
[CUT CUT]
Ludovic, thank you again about your response... Ok, I use BTM only for iBatis (r/w) and push on queue... for enque from Oracle AQ I use (4 now) simple connection e commit/rollback non JTA.
       
I am very busy by work, but I'm cutting out time to finish the guide for BTM and Oracle AQ to be made available to the community.

Thank you!