🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Message redelivery for New Java API - if an exception or un-acknowledgement happened

Sreekanth
Sreekanth Member Posts: 13 ✭✭
edited September 2023 in Tips and Tricks #1
I am exploring new Java API for solace integration. I have noticed that message redelivery is not happening if an exception happened in consumer thread. In JCMP api we were able close/ unbind and bind consumer. Spring cloud stream binder also doing same way. But new Java API I those apis's were not exposed. Please let me know How to achieve this functionality.

Best Answer

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee
    #2 Answer ✓

    Hello,

    That technique of unbinding and rebinding is not present in the Java API like it was in JCSMP. The way you handle that situation is different, however, I have some good news for your use case.

    Coming very shortly in Java 1.4.0 is the ability to negatively acknowledge (NACK) messages with 2 different outcomes:

    • FAILED - meaning the processing of the message encountered a problem in the consumer app and so the message should be redelivered from the broker (according to the redelivery settings on the queue). I think this is what you are looking for.
    • REJECTED - a "poison" message outcome. The application has determined that the message is bad and redelivering it would not result in it being successful, so the broker should NOT redeliver and should send the message to a DMQ (if configured on the queue) or dropped (if no DMQ configured)

    I think a NACK will be the best way to handle your exception on the message. Unbind/rebind was really a workaround for not having a NACK for individual messages.

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee
    #3 Answer ✓

    Hello,

    That technique of unbinding and rebinding is not present in the Java API like it was in JCSMP. The way you handle that situation is different, however, I have some good news for your use case.

    Coming very shortly in Java 1.4.0 is the ability to negatively acknowledge (NACK) messages with 2 different outcomes:

    • FAILED - meaning the processing of the message encountered a problem in the consumer app and so the message should be redelivered from the broker (according to the redelivery settings on the queue). I think this is what you are looking for.
    • REJECTED - a "poison" message outcome. The application has determined that the message is bad and redelivering it would not result in it being successful, so the broker should NOT redeliver and should send the message to a DMQ (if configured on the queue) or dropped (if no DMQ configured)

    I think a NACK will be the best way to handle your exception on the message. Unbind/rebind was really a workaround for not having a NACK for individual messages.

  • Sreekanth
    Sreekanth Member Posts: 13 ✭✭
    edited October 2023 #4

    @amackenzie Thanks for the answer!

    When can we expect the new 1.4.0 release? And what would you suggest do We need to proceed with JCMP or spring cloud binder implementation or Its worth to wait for new release with Java API ?