Java EE – the JMS message to be redelivered to the queue

I use JBoss MQ in my application

I am trying to process messages that are redelivered to the JMS queue Is there any way I can set some value in the original message received by the consumer (the first time I received the message) so whenever I redeliver the message, I can read the value and make some decisions

If the problem is not clear, please let me know and I can try to explain it in detail

Solution

No, JMS doesn't work that way

You interact with the queue as a consumer (receiver), producer (sender), or browser (Peeker) There is no action to put back changed messages If the consumer is working in a rolled back transaction, the message will be displayed as "put back", but only because it is waiting in the queue for the transaction to commit

In theory, you can create a producer for the same queue that gets messages, modify it and "send it to yourself" (message driver bean?), But this is just a different message, only similar content It will reach the end of the queue This is certainly not recommended

It is best to keep the message data (at least the part you are interested in) in the database to detect whether it is new or retransmitted

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>