users@jms-spec.java.net

[jms-spec users] Re: Confusion about JMSProducer methods and CDI

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Tue, 17 Jun 2014 14:10:28 +0100

On 17/06/2014 12:24, Matthew White wrote:
> Hello;
>
> The producer issue appears to be a defect; the time-to-live is a property of the producer not the context so why would
> it be carried over?
>
> Regards, Matthew.

Elias reported the following alleged behaviour in HornetQ

> I'm really confused by this because this code doesn't do what you might expect:
>
> JMSProducer p = JMSContext.createProducer();
> p.setTimeToLive(1000);
> p.send(...)
> JMSProducer p2 = JMSContext.createProducer();
> p2.send(...) // time to live is set to 1000 here!
>
> The settings from JMSProducer p are carried over to p2.
>
> What's the point of having two producers here? The JavaDoc says "new
> producer" but in fact the settings are carried over from the old
> producer object.

If the second message had a TTL of 1000 then that isn't right.

The Javadocs for the method setTimeToLive defines it as specifying "the time to live of messages that are sent using
this JMSProducer." So setting the value on one JMSProducer doesn't affect messages sent using another JMSProducer.

Elias added:

> I was using HornetQ, but it looks like the reference implementation
> does do the same thing

The RI (Open MQ) doesn't do that, as I explained in my reply on 9th June.

Nigel