I am currently implementing a consumer which listens to events sent by an ActiveMQ Artemis Broker.
I've found this article which says:
The main difference between 1 & 2 and 3 & 4 is the latter allow messages to be rolled back and redelivered if an error occurs whilst processing
So I assume a redelivery with 1 & 2 (Client Acknowledgement) is not possible.
Here in the docu from Apache it is said
Messages can be delivered unsuccessfully (e.g. if the transacted session used to consume them is rolled back)
I assume CLIENT_ACKNOWLEDGE is no transaction so this isn't valid for, correct?
So if I set lets say <redelivery-delay>300000</redelivery-delay> there will be any message redelivery after 5 Minutes?
The Spring Documentation here says:
"sessionAcknowledgeMode" set to "CLIENT_ACKNOWLEDGE": Automatic message acknowledgment after successful listener execution; best-effort redelivery in case of a user exception thrown as well as in case of other listener execution interruptions (such as the JVM dying).
This is a bit confusing. I have found also this configuration for ActiveMQ Artemis so I have these questions:
- Is a redelivery possible with
CLIENT_ACKNOWLEDGE - If yes, what is the difference between a redelivery with
@Transactionaland an omittedMessage.acknowledge()call? Which should I prefer when over the other? - If no, what does the Spring documentation actually mean?
For a message to be redelivered, the Artemis message broker must be aware that the message needs to be redelivered.
In the case of
CLIENT_ACKNOWLEDGEmode, there are no timeouts, but the JMS session could fail for a variety of reasons. For example, start up your client, consume but do not acknowledge the messages. Then kill your client (terminate the java process). The messages will be available for delivery/redelivery.In the case of a transacted session, if the transaction context fails (times out, etc.) then the message will once again be available for delivery. The same conditions also apply as above to the session failing in the transacted case.