0
votes

I have a HornetQ based JMS provider and the consumer is attached to the provider in the CLIENT_ACKNOWLEDGE_MODE . The message.acknowledge () snippet though is under an if else . Thus the consumer would sometimes would not send an acknowledgement to the server in case there was an application layer failure in processing the message .So there are two questions here -

1)Will more messages that are queued in the server will keep on flowing to the consumer even though the consumer did not acknowledge on of the messages as stated earlier

2)Will the unacknowledged message flow down again on restarting the consumer .

These are some of my observations on the questions I have asked

1)The messages keep on flowing down to the consumer as per the consumer logs even though it did not acknowledge one of the messages to the server due to an application layer failure (Note , there was no uncaught exception as such , just that the consumer did not acknowledge) .

2)Secondly , on restarting the consumer as well the message did not flow down again from the server which is surprising .

Can someone please clarify this behaviour?

1

1 Answers

0
votes

It has hard to fully determine what your application is doing in terms of message acknowledgement but my guess is that you are continuing to acknowledge messages after the failed attempt to acknowledge the message in question. In that case because you are using the Client Acknowledge mode the next Acknowledge will also apply to the previous message as that is how client mode works.

Session.CLIENT_ACKNOWLEDGE: A client acknowledges a message by calling the message’s acknowledge method. In this mode, acknowledgment takes place on the session level: Acknowledging a consumed message automatically acknowledges the receipt of all messages that have been consumed by its session. For example, if a message consumer consumes ten messages and then acknowledges the fifth message delivered, all ten messages are acknowledged.

So if you read that carefully you will see how consumers in a Session acknowledging messages while in client Acknowledge mode could even affect one another.

For a better answer you'd need to break down the chain of event further so that in became more clear what is going on.