Reprocess of messages

We have similar scenario like below discussion


our scenario is

1) Consumer consuming message A

2) we have disable auto ack

3) Consumer failed while processing messages A and catched exception

4) Message is not acknowledge

5) We want to retry same message again


In current scenario we can see message on solace queue after exception and its not getting removed so that looks ok but its not getting reprocessed or reconsumed.


If we have to reque a message ..will this be requed at head or tail of queue(sppoled message)?

Comments

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 898 admin

    Hi @ajinkyasagar,

    If the app never unbinds it's flow the message will not be redelivered as the broker just assumes the app is still processing it.

    So I'd say there are 3 options:

    1. Handle the exception in your current app + ack the msg
    2. Publish the message to another topic where messages with this exception end up + ack the msg (this allows you to handle the issue with another app or maybe even manually?
    3. Unbind your flow so the broker can re-deliver it to the same instance of your app once it rebinds or another instance if there are multiple consumers

    Not that if you go route #3 the message would remain at the front of the queue.

  • ajinkyasagar
    ajinkyasagar Member Posts: 24

    In option 2 if we redirect to diffrent queue then from original queue other messages will get processed and we will loose sequential processing of messages...


    Is there not option to redeliver same message again because there might be scenario where messages is valid but issue with processing app and we won't be able to process message in sequence .

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 898 admin

    Hi @ajinkyasagar,

    Correct, if order matters then you wouldn't want to use option 2.

    I believe option 3 is what you are looking for. Essentially unbind your flow and then rebind the flow. Doing this maintains order and will have the same message re-delivered assuming that max-redeliveries has not been exceeded.

  • ajinkyasagar
    ajinkyasagar Member Posts: 24

    Thanks for your input

    1) is there any configuration for max-redeliveries in yaml file for spring streaming?

    2) binding is created by spring boot itself so is there any bean/class which can be autowired to bind and unbind quickly?even some sample code will help..

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 898 admin

    Hi @ajinkyasagar,

    Are you using Spring Cloud Stream or Spring Boot JMS or Spring Boot JCSMP?

  • ajinkyasagar
    ajinkyasagar Member Posts: 24

    Spring Cloud Stream.

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 898 admin

    Hi @ajinkyasagar,

    Hope you're doing well. I was OOO over the holiday weekend so sorry for the delay in getting back to you. Now that I know you're using Spring Cloud Stream it makes it a bit easier to answer the questions :)

    Item 1: max-redeliveries 

    This configuration is set on your queue. So if you are allowing the Spring Cloud Stream binder to create the queue, which is the default, you can set that via queueMaxMsgRedelivery in the Solace Consumer Properties. If you are pre-creating via your CI/CD pipeline then you would set it at queue creation time.

    Item 2: rebind/unbind.

    Since you're using Spring Cloud Stream you actually don't need to worry about doing the unbind/rebind yourself. When you want more control over how the message is acked you can use Manual Acknowledgement mode and then the Solace binder handles things such as unbind/rebind for you. Check out Section 8 - Client/Manual Acknowledgements in the Beyond the Basics codelab to see how to use it, but under the covers if you ack the message with a "requeue" the binder will do the unbind/rebind for you.


    Hope that helps!