Issue with ActiveMQ/JMS 2.0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with ActiveMQ/JMS 2.0

COURTAULT Francois-3
Hello,

I know that ActiveMQ doesn't cover all JMS 2.0 specification.
Could you tell me, please, how far ActiveMQ is close to JMS 2.0 ?

I am asking this question because I am using TomEE 8.0.0 or 8.0.1 with ActiveMQ 5.15.10 embedded.
In an stateless EJB, I inject JMSContext (working) and in a method, I have the following code:
         jmsContext.createProducer().send(messageQueue, jmsContext.createTextMessage("Test"));

The issue I have is that each time I send a text message a DynamicProducer is created which could be the root cause of a memory leak.

But looking at the docs:
https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html (new way JMS 2.0)
https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html (old way JMS 1.1)

I find something not coherent. Indeed:

·         Using Session (JMS 1.1), we are able to create a Producer targeting a destination : createProducer<https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination->(Destination<https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html> destination). So no, dynamic producer is created.

·         Using JMSContext (JMS 2.0) , we are able to create a Producer but with no destination (createProducer<https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html#createProducer-->()) => dynamic production creation.
Why don't we have on JMSContext the same method createProducer<https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination->(Destination<https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html> destination) ?

But I also don't get that, according to the JMS 2.0 specification, the JMSContext injected has a Transaction scope => this mean that after the end of the method, the JMSContext should be closed so that the dynamic producer.
Do you agree with the behavior described above. If so, Is it an ActiveMQ issue or a TomEE issue ?

Looking at https://www.oracle.com/technical-resources/articles/java/jms20.html
A sample is provided in § Injecting a JMSContext into a Java EE Application:
              context.send(dataQueue, body);   => but the JMSContext java doc I didn't find any send method. So I guess it's a mistake, right ?

Best Regards.

Reply | Threaded
Open this post in threaded view
|

Re: Issue with ActiveMQ/JMS 2.0

christopher.l.shannon
ActiveMQ 5.x does not support any part of JMS 2.0.  There has been talk of
it but it would require a lot of work to get there and isn't close.

For JMS 2.0 support I would recommend looking at Artemis which is the next
generation broker and already supports it.

On Mon, Feb 10, 2020 at 3:11 AM COURTAULT Francois <
[hidden email]> wrote:

> Hello,
>
> I know that ActiveMQ doesn't cover all JMS 2.0 specification.
> Could you tell me, please, how far ActiveMQ is close to JMS 2.0 ?
>
> I am asking this question because I am using TomEE 8.0.0 or 8.0.1 with
> ActiveMQ 5.15.10 embedded.
> In an stateless EJB, I inject JMSContext (working) and in a method, I have
> the following code:
>          jmsContext.createProducer().send(messageQueue,
> jmsContext.createTextMessage("Test"));
>
> The issue I have is that each time I send a text message a DynamicProducer
> is created which could be the root cause of a memory leak.
>
> But looking at the docs:
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html
> (new way JMS 2.0)
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html (old
> way JMS 1.1)
>
> I find something not coherent. Indeed:
>
> ·         Using Session (JMS 1.1), we are able to create a Producer
> targeting a destination : createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination-
> >(Destination<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html>
> destination). So no, dynamic producer is created.
>
> ·         Using JMSContext (JMS 2.0) , we are able to create a Producer
> but with no destination (createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html#createProducer-->())
> => dynamic production creation.
> Why don't we have on JMSContext the same method createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination-
> >(Destination<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html>
> destination) ?
>
> But I also don't get that, according to the JMS 2.0 specification, the
> JMSContext injected has a Transaction scope => this mean that after the end
> of the method, the JMSContext should be closed so that the dynamic producer.
> Do you agree with the behavior described above. If so, Is it an ActiveMQ
> issue or a TomEE issue ?
>
> Looking at
> https://www.oracle.com/technical-resources/articles/java/jms20.html
> A sample is provided in § Injecting a JMSContext into a Java EE
> Application:
>               context.send(dataQueue, body);   => but the JMSContext java
> doc I didn't find any send method. So I guess it's a mistake, right ?
>
> Best Regards.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with ActiveMQ/JMS 2.0

jgallimore
In reply to this post by COURTAULT Francois-3
I notice you're using TomEE, and asked on the TomEE mailing list. TomEE
uses ActiveMQ 5, and provides a bridge for the JMS 2.0 functionality you're
using. The issue is more likely on the TomEE side, and I'll follow up there.

Jon

On Mon, Feb 10, 2020 at 8:11 AM COURTAULT Francois <
[hidden email]> wrote:

> Hello,
>
> I know that ActiveMQ doesn't cover all JMS 2.0 specification.
> Could you tell me, please, how far ActiveMQ is close to JMS 2.0 ?
>
> I am asking this question because I am using TomEE 8.0.0 or 8.0.1 with
> ActiveMQ 5.15.10 embedded.
> In an stateless EJB, I inject JMSContext (working) and in a method, I have
> the following code:
>          jmsContext.createProducer().send(messageQueue,
> jmsContext.createTextMessage("Test"));
>
> The issue I have is that each time I send a text message a DynamicProducer
> is created which could be the root cause of a memory leak.
>
> But looking at the docs:
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html
> (new way JMS 2.0)
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html (old
> way JMS 1.1)
>
> I find something not coherent. Indeed:
>
> ·         Using Session (JMS 1.1), we are able to create a Producer
> targeting a destination : createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination-
> >(Destination<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html>
> destination). So no, dynamic producer is created.
>
> ·         Using JMSContext (JMS 2.0) , we are able to create a Producer
> but with no destination (createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/JMSContext.html#createProducer-->())
> => dynamic production creation.
> Why don't we have on JMSContext the same method createProducer<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Session.html#createProducer-javax.jms.Destination-
> >(Destination<
> https://javaee.github.io/javaee-spec/javadocs/javax/jms/Destination.html>
> destination) ?
>
> But I also don't get that, according to the JMS 2.0 specification, the
> JMSContext injected has a Transaction scope => this mean that after the end
> of the method, the JMSContext should be closed so that the dynamic producer.
> Do you agree with the behavior described above. If so, Is it an ActiveMQ
> issue or a TomEE issue ?
>
> Looking at
> https://www.oracle.com/technical-resources/articles/java/jms20.html
> A sample is provided in § Injecting a JMSContext into a Java EE
> Application:
>               context.send(dataQueue, body);   => but the JMSContext java
> doc I didn't find any send method. So I guess it's a mistake, right ?
>
> Best Regards.
>
>