0

I am trying to build a simple chat app using Java Servlets and JMS.

I have set up two channels(msg and ack).

msg to send the message and ack to receive the acknowledgement.

How do I send the message again if the acknowledgement is not received within a specified time?

Please ask if more details are required.

aBhijit
  • 5,261
  • 10
  • 36
  • 56
  • Who is sending the `ack`, the chat peer, or the JMS server? If server, acks are automatic is using `AUTO_ACKNOWLEDGMENT`. – raffian Oct 07 '13 at 21:16
  • I am using 'AUTO_ACKNOWLEDGMENT'. How do I make sure whether I got the ack for a message or not? Do I get a boolean value telling me that the server received the response? If yes, how and where do I access this? – aBhijit Oct 08 '13 at 08:07

1 Answers1

1

When sending a JMS message using AUTO_ACKNOWLEDGMENT, the message is auto-ack'ed by the server. If the server throws a JMSException back to the client, something went wrong and the message was either not received or persisted by the server; this is the signal to resend the message.

If no exception is thrown, you can assume the message was received by the server. You don't need a separate ACK channel for this; it's implied through JMS.

Additional Info https://stackoverflow.com/a/11673930/791406

Community
  • 1
  • 1
raffian
  • 31,267
  • 26
  • 103
  • 174