Pergunta

I have a scenario where an ActiveMQ store enqueues messages if an endpoint is down, and I attempt to redeliver all of the enqueued messages upon receiving new requests. The newest message would therefore be the last one to be processed. If the endpoint is still down, the newest message is also enqueued, and the process will kick off again if it receives a new message.

The problem I'm having with this approach is that it would be possible to end up with an unordered queue if the endpoint is still down when I pop a message and reattempt processing, since the message will be reinserted to the BACK of the queue instead (e.g. from MSG1, MSG2 to MSG2, MSG1).

I considered adding a server-status check prior to popping so far, but I was curious to know if there was another way around that, or if I am simply tackling the redelivery method incorrectly.

Foi útil?
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top