Friday, April 11, 2008

Messaging based transactions and Weblogic JMS Distributed queues

Assume you have system where you have implement asynchronous processing as below
The client send the request to Session bean, which after some processing sends a message (with some correlation id) to a queue for further asynchronous processing. Another MDB process the message and sends the result back to another queue (with same correlation id). The client listen on the second queue (with selector for this particular correlation id) and updates it's state.
This will work on Normal single JMS Server. However it will break on WebLogic Distributed JMS queues. When you establish a connection with Distributed queue, you establish connection with a member JMS and you will receive messages only from that queue, similarly when you send a message, that will be sent to only the member JMS where you are connected.
That means you will not receive messages reached into the other member JMS server. For some of your requests you will never get responses because that requests reached the other Server.
Solution: User topic and ignore messages with other correlation ids.
Problem with Distributed topic
When u send message to distributed topic that will be forwarded to other member JMS servers (to deliver message to the subscribers connected to other JMS servers). If one JMS server is down messages will be persisted and will be forwarded when the server comes up. The Topic subscriber was originally connected to first JMS server and received the topic. and now he got reconnected to second JMS server. Now the client will receive the message again from the second JMS server.

No comments: