• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS problem

 
Francesco Marchioni
author
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
We have a j2ee application where a JMS queue notifies clients (consumers) about their elaboration process.

In other words when the client is connected it should receive messages like "Elaboration started", "Elaboration completed" and so on.

Since there are many clients, I have added to the message a clientId property so that inside onMessage the message is acknowledged only if it "belongs" to the client. (CLIENT_ACKNOWLEDGE).

Here comes the problem.

Suppose "Elaboration started - client 1" message goes to client 2 (which refuses the message) and meanwhile "Elaboration completed - client 1" goes to client 1 (whick acks the message and close connection)
then client 1 will never receive the first message because the connection is closed !

I hope my explanation is clear.

How would you correct this architecture ? I'm thinking to add a sequence number to the message so that they are ack'ed in the right order......maybe there are some feature of jms I miss which could be better.....like jms temporary queues ?

any idea ?
Thanks
Francesco
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose "Elaboration started - client 1" message goes to client 2 (which refuses the message) and meanwhile "Elaboration completed - client 1" goes to client 1 (whick acks the message and close connection)


You are sharing the Connection object among the consumers of the "Elaboration.." message. Acknowledging the message does not mean that the connection is closed. The connection must be closed explicitly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!