-
Notifications
You must be signed in to change notification settings - Fork 111
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
KafkaListener OffsetStrategy.DISABLED Manual Acknowledgement Failure (Reactive Type) #103
Comments
Perhaps its happening in a different thread since its chained in the reactive stream? |
After reading around the documentation a bit, I was able to find this:
After adding the |
@brianwyka Not sure that it will change the exception, but are you trying to bee reactive on the way IN or the way OUT or both? Just writing pseudo code here from your above example. public void processMessage(@Body final Single<PayloadArchiveUploadMessage> payloadArchiveUploadMessage, final Acknowledgement c) {
payloadArchiveUploadMessage.doOnSuccess((payload) -> {
val payloadKey = payload.getPayloadRequest().getPayloadKey();
val payloadKeyString = PayloadKeyFormatter.asString(payloadKey);
archive(payload, payloadKeyString) //call out to the archive process? Is this reative too?
acknowledgement.ack();
});
} Also should you synchronize the method? |
Kafka consumers are inherently single threaded so you have to always acknowledge the message on the same thread as the listener executed on. That means waiting for all other publishers to complete |
@graemerocher is there any way to bind a method argument which would be a callback to the publishers being completed which is a |
@ctoestreich I am trying to be reactive on the way out, such that Micronaut treats it as a non-blocking subscription. I could also take the |
Thinking about it more, seems like it would be non-trivial to have some sort of callback (in reactive style) which executes in the same thread as the polling loop... |
With a
@KafkaListener
that has offset strategy diabled, when using the reactive approach, theAcknowledgement.ack()
produces an exception when called within the@KafkaListener
.Below is the exception:
My assumption is the error is triggered from the lambda implementation of
Acknowledgement
below inKafkaConsumerProcessor
:micronaut-kafka/kafka/src/main/java/io/micronaut/configuration/kafka/processor/KafkaConsumerProcessor.java
Lines 488 to 492 in 0d9f891
Relevant consumer thread configuration:
The text was updated successfully, but these errors were encountered: