سؤال

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.

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top