Skip to content

Commit

Permalink
GH-3400: Clarify manual ack semantics
Browse files Browse the repository at this point in the history
Fixes #3400
  • Loading branch information
sobychacko authored Aug 1, 2024
1 parent 20696f2 commit c5904b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ If seekPosition set `TIMESTAMP`, `initialOffset` means timestamp.
== Manual Acknowledgment

When using manual `AckMode`, you can also provide the listener with the `Acknowledgment`.
To activate the manual `AckMode`, you need to set the ack-mode in `ContainerProperties` to the appropriate manual mode.
The following example also shows how to use a different container factory.
This custom container factory must set the `AckMode` to a manual type by calling the `getContainerProperties()` and then calling `setAckMode` on it.
Otherwise, the `Acknowledgment` object will be null.


[source, java]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
* @author Nathan Xu
* @author Wang ZhiYang
* @author Huijin Hong
* @author Soby Chacko
*/
public abstract class MessagingMessageListenerAdapter<K, V> implements ConsumerSeekAware, AsyncRepliesAware {

Expand Down Expand Up @@ -440,8 +441,7 @@ private RuntimeException checkAckArg(@Nullable Acknowledgment acknowledgment, Me
if (this.hasAckParameter && acknowledgment == null) {
return new ListenerExecutionFailedException("invokeHandler Failed",
new IllegalStateException("No Acknowledgment available as an argument, "
+ "the listener container must have a MANUAL AckMode to populate the Acknowledgment.",
ex));
+ "the listener container must have a MANUAL AckMode to populate the Acknowledgment."));
}
return new ListenerExecutionFailedException(createMessagingErrorMessage("Listener method could not " +
"be invoked with the incoming message", message.getPayload()), ex);
Expand Down

0 comments on commit c5904b1

Please sign in to comment.