Shawyeok commented on issue #23944:
URL: https://github.com/apache/pulsar/issues/23944#issuecomment-2712149063

   > However, I've come across a scenario where certain payloads cause 
third-party libraries to generate oom (e.g. processing complex files that can't 
be directly determined by file size), and it's not easy to go deeper into the 
third-party libraries and rewrite the relevant logic. I'd like to be able to 
handle this with the crash retry mechanism in the message queue so that these 
errors are handled transparently and don't introduce extra work.
   
   Now I have a better understanding of what you’re aiming for. Have you tried 
the following strategy?
   ```java
   try {
     // business logic
   } catch (AnyHandlableException e) {
     // business logic 
   } catch (Throwable e) {
     consumer.negativeAcknowledge(messageId);
   }
   ```
   
   Additionally, you might not want to combine this solution with the following 
JVM runtime options:
   `-XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError 
-XX:OnOutOfMemoryError="kill -9 %p"`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to