Try PubSub+

Message Ordering

NagaNaga Member Posts: 57

I have a requirement where Message ordering is the key.
When 10 messages are published to solace with order numbers OD1,OD2,OD3…OD10
While consuming if the first message OD1 fails the consumer should be receiving OD1 and then OD2 so on. The consumer should not be receiving OD2 before OD1.

This way the order should be maintained. Is there a way we can achieve this ?


  • TomFTomF Member, Employee Posts: 265 Solace Employee
    edited September 2020 #2

    Hi @Naga, message ordering sounds simple but the conversation always ends up being involved.
    Solace by default enforces message ordering, with the unit of order being reception time at the broker. You should use a queue to ensure that ordering is maintained even if the consumer is offline.
    Things get more complicated when we start to think about consumer failures. What if the consumer gets OD1 and it causes the consumer to crash? Well, you have some knobs to twiddle. If OD1 must be before OD2 even at the expense of system failure, leave the queue defaults as they are. If, however, you'd like to set a maximum number of re-tries before the broker considers OD1 to be "poisonous" and optionally discard or move it to a dead message queue, then change the "Maximum Redelivery Count" setting on the queue.

  • AaronAaron Member, Moderator, Employee Posts: 279 Solace Employee

    Just to be explicit, you can't use non-exclusive queues if strong message ordering is required... only Exclusive queues will ensure that message order is properly maintained, even in the event of an application crash / unbind.

  • TomFTomF Member, Employee Posts: 265 Solace Employee

    Good point @Aaron. Non-exclusive queues give you application load balancing at the expense of breaking message ordering as messages are round-robin-ed between applications.

Sign In or Register to comment.