开发者

MDBs and dupe messages

Let's pretend that an MDB has received a message and has started processing it in a CMT/Required transaction and let's assume that the transaction might take some time to complete.

In such a scenario, would it be possible for a duplicate message to be 开发者_如何学JAVAreceived and processed by another MDB instance in another transaction, while the first transaction is still in progress?

Or will the container ensure that while an MDB is busy processing a message in a CMT/Required transaction, no other MDB instance will receive a dupe of that same message?


I would expect any message to be locked while part of a transaction, and duplicates shouldn't be sent, as the JMS specification requires:

4.4.15 Duplicate Production of Messages: JMS providers must never produce duplicate messages. This means that a client that produces a message can rely on its JMS provider to insure the consumers of the message will only receive it once.

so I think you can rely on the messaging provider to ensure that the MDB does not receive a second copy of the message unless the first is either explicitly rolled back or the transaction is timed out and implicitly rolled back. Both of these operations should 'unlock' the message and make it available for redelivery to the MDB, with JMSRedelivered set to true and JMSXDeliveryCount incremented.

I suspect there are more requirements to supplement the JMS spec in one (or more) of the EJB, JCA or JTA specifications (or J2EE, for that matter), I haven't checked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜