Acknowledge manually #280
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
This is not possible, and that is the purpose of the library to simplify this subscription and ack concept. There was no need to implement such behaviour with manual consumption yet. Is this something that would be interesting for you? |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for your response. Yes, it would be. Let me express why I need such control. Think about a scenario in which you consume messages and write them to the database or 3rd party system if you get an error you would like to reprocess the message. Maybe your wrapping code does not give an acknowledge when you get an error I didn't investigate the whole code but anyway it would be a useful addition to give the user additional control... |
Beta Was this translation helpful? Give feedback.
-
In that case, any Exception thrown will work because the msg is only acknowledged when the function ends successfully. In case of any exception thrown during the method execution, the message will be acknowledged negatively. If you have correctly configured the retry mechanism, it will also try to process the message again later or send it to the dead letter topic. However, I believe that having manual control can be helpful as well. But your described use case could be easily solved, I believe. So, in general, the answer is: You can achieve negative ack with any Exception thrown during execution. |
Beta Was this translation helpful? Give feedback.
-
Is this configuration works with the 1.12.0 version ? Because I use a shared subscription and consume a topic of 18 million of records in it. I see that some messages are being delivered again and again. Probably they are not being acknowledged... I tested with a smaller data no problem raised... pulsar.consumer.default.dead-letter-policy-max-redeliver-count=-1 |
Beta Was this translation helpful? Give feedback.
-
There is another case that could cause this - the exception thrown is a type of RuntimeException - as that type of exception is ignored by design. |
Beta Was this translation helpful? Give feedback.
This is not possible, and that is the purpose of the library to simplify this subscription and ack concept. There was no need to implement such behaviour with manual consumption yet. Is this something that would be interesting for you?