Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When using message queues in WSO2 Message Broker, messages are removed from the message store when the message consumers acknowledge the messages were received. There are several acknowledgement models defined in in JMS specification 1.1

To configure the time within which consumers can acknowledge that messages were received, you can set the AndesAckWaitTimeOut entry in the JMS client:

Code Block
System.setProperty("AndesAckWaitTimeOut", "30000");

If the acknowledgement fails within this time, the client informs the MB sever that this message was rejected from the client. The message is then scheduled to be redelivered later by the server. If you want to limit the number of times the message broker attempts to deliver redeliver the message, you can set the maximumNumberOfMessageDeliveryAttempts entry the maximumRedeliveryAttempts entry in the andes-configbroker.xml file file:

Code Block
languagehtml/xml
<!--Broker will drop the message after the configured number of delivery attempts for each message.-->
	    <maximumNumberOfMessageDeliveryAttempts>10<<maximumRedeliveryAttempts>10</maximumNumberOfMessageDeliveryAttempts>maximumRedeliveryAttempts>

Note that this is the above configuration specifies the total number of delivery attempts, not re-delivery attemptsattempts to redeliver the message after the original delivery attempt. For example, when the first attempt to send the message fails, there will be another 10 attempts to redeliver the message. After the maximum number of re-delivery attempts attempts to redeliver the message are breached, the message is sent to the Dead Letter Channel. This is useful when the client application does not acknowledge the message because an operation on the message failed.

If the message is successfully delivered on a redelivery attempt, the the JMSRedelivered field  field is set to 'true' in the message header, allowing the client to determine whether the message was delivered on its original attempt or on a redelivery attempt.