jsr343-experts@jms-spec.java.net

[jsr343-experts] Re: [jms-spec users] Re: JMS 2.0 Early Draft ready for final review

From: Rüdiger zu Dohna <ruediger.dohna_at_1und1.de>
Date: Tue, 20 Mar 2012 16:25:51 +0100

On 2012-03-20, at 15:45, Nigel Deakin wrote:
> On 20/03/2012 13:30, Rüdiger zu Dohna wrote:
>> I would leave the MessagingContext itself dependent scope. The underlying, eventually pooled Connection and/or
>> Session should be shared by all MessagingContexts within one transaction, so they all are sent within the same
>> transaction and in the guaranteed order.
>
> This is a definition of transaction scope.

Except for different instances of the MessagingContext may be configured to use different delivery modes, delivery delays, priorities, etc.

> (I don't know whether it's necessary to describe the injected object as being dependent scope since it's just a proxy.
> After all, a request-scoped object is just a proxy as well. But this is just a detail.)
>
>> If there is no transaction available, every message is sent immediately with its own transaction/Session, and maybe
>> even Connection.
> ...
> That's undesirable not only in terms of message ordering but resource usage.
> ... [many more good points snipped]


You are perfectly right, even with pooled connections, this is not really desirable.

Maybe a MessagingContexts would use a separate Session as long as no transaction is available? Would you expect guaranteed message order, if you use different MessagingContexts and no transactions?

I'm insisting on this point, because I don't want to have to explain to developers how those two scopes interrelate to each other... I just think there *must* be some way to handle that with *one* scope, namely transaction scope, while without any scope, only a "local" transaction is available with only message ordering guaranteed locally to that context.