-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RabbitListener's returning Mono<Void> doesn't ack the message #1006
Comments
Fixes spring-projects#1006 When listener method returns `Mono<Void>`, the `success` callback is not called from the Reactor because there is no value to handle. * Move `basicAck()` to the `completeConsumer` which is called when `Mono` is completed successfully with value or without **Cherry-pick to 2.1.x**
Fixes #1006 When listener method returns `Mono<Void>`, the `success` callback is not called from the Reactor because there is no value to handle. * Move `basicAck()` to the `completeConsumer` which is called when `Mono` is completed successfully with value or without **Cherry-pick to 2.1.x**
Fixes #1006 When listener method returns `Mono<Void>`, the `success` callback is not called from the Reactor because there is no value to handle. * Move `basicAck()` to the `completeConsumer` which is called when `Mono` is completed successfully with value or without **Cherry-pick to 2.1.x**
This still appears to be a problem. @RabbitListener(queues = "audit")
Mono<Void> listen(CustomerActivityEventWrapper wrapper) {
log.debug("Received message {}", wrapper.toString())
strategies
.find { it.handles(wrapper.payload) }
.handleEvent(wrapper.payload)
// 👆 returns a Mono<Void>
} The API call happening within my strategy occurs, but I still see this in the console:
|
@jndietz , Sorry, what the problem are you observing? |
@artembilan There is an
My thought is that it isn't acking the message when it should be. |
I guess that's because you didn't follow the recommendation from the previous log:
|
Yep... you're right. I guess I mixed up how @RabbitListener(queues = "audit", ackMode = "MANUAL") // 👈 no actual acknowledgement needed in the code below
Mono<Void> listen(CustomerActivityEventWrapper wrapper) {
log.debug("Received message {}", wrapper.toString())
strategies
.find { it.handles(wrapper.payload) }
.handleEvent(wrapper.payload)
} Thanks @artembilan |
I suppose the error message emitted by the amqp-client might be a bit confusing:
In this case, it means delivery tag 1 has already been acknowledged (and therefor the second ack used an "unknown" tag. |
As discussed on stackoverflow a
RabbitListener
returningMono<Void>
will not ack the message. For example:The reason is that
spring-rabbit
doesn't seem to handle empty streams.The text was updated successfully, but these errors were encountered: