users@jms-spec.java.net

[jms-spec users] [jsr343-experts] Re: (JMS_SPEC-90) Provide simpler mechanism to refer to queues and topics in a portable way

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Fri, 30 Mar 2012 15:09:05 +0100

Rüdiger,

On 27/03/2012 18:45, Rüdiger zu Dohna wrote:
> Nigel,
>
> On 2012-03-27, at 19:25, Nigel Deakin wrote:
>> Currently this is up to the provider. Session.createTopic(name) is allowed to throw an exception if the topic hasn't
>> been administratively created, but since several JMS providers also use this method to create the topic (despite the
>> spec discouraging it) I think we need to recognise this officially. Please see http://java.net/jira/browse/JMS_SPEC-31
>>
>> We could define a new method which never creates the topic (i.e. any auto-creation feature is disabled), though I
>> can't see why you would want to do this. Given that auto-creation is a JMS provider specific feature, disabling it
>> should be too.
>
> The code would be not portable, then. Maybe it should be required... and thereby making the name a little bit more
> clear about what will happen. Actually it should best be getOrCreate.
>
> I still think that if you have many applications accessing one messaging system, auto-creation can become very
> annoying. If one of the applications has a bug, you don't want to go around searching for which one might have created
> that strange new queue. In that case it would be better if the application itself would receive an exception instead.
>
> So I think that the spec should also require a feature to disable this behavior.
>

We'll have an opportunity to discuss auto-creation of destinations when we discuss http://java.net/jira/browse/JMS_SPEC-31 .

However I'd just like to respond to your suggestion that the use of automatically-created destinations (in existing JMS
providers) makes the code non-portable. JMS has always considered the mechanism for creating the actual queues and
topics in the JMS provider to be outside the scope of JMS. The queues and topics might either need to be created using
some kind of administration tool, or they might be created automatically when used. It doesn't make any difference to
the code which mechanism is used. It only affects what the administrator has to do.

Nigel