JMS error after 3922 invokations (Spring-JMS)

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

JMS error after 3922 invokations (Spring-JMS)

asaksena1
I'm running the  Spring Remoting with JMS (@ http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a loop to evaluate the Camel for my project.
I'm getting the following consistent error after 3922 invocations.

Can anyone tell me what is the cause for this.

++++
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connect
        at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
        at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
        at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
        at org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
++++
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
What I guess is that camel opens a connection for each invocation.  Can
you try to use the  Spring  SingleConnectionFactory?
     <bean id="jmsConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="tcp://localhost:61616" />
            </bean>
        </property>
    </bean>

Greetings

Christian

asaksena1 schrieb:

> I'm running the  Spring Remoting with JMS (@
> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
> loop to evaluate the Camel for my project.
> I'm getting the following consistent error after 3922 invocations.
>
> Can anyone tell me what is the cause for this.
>
> ++++
> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
> occured during JMS processing; nested exception is javax.jms.JMSException:
> Could not connect to broker URL: tcp://localhost:61616. Reason:
> java.net.BindException: Address already in use: connect
> at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
> at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
> at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
> at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
> at
> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
> ++++
>  


--

Christian Schneider
---
http://www.liquid-reality.de

Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Claus Ibsen-2
Hi

Actually if you are using ActiveMQ as the broker we encourage to use
the ActiveMQComponent that is shipped with ActiveMQ itself

See this page:
http://activemq.apache.org/camel/activemq.html

So you can do this:

  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="vm://somehost"/>
  </bean>



/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Fri, Dec 5, 2008 at 8:09 AM, Christian Schneider
<[hidden email]> wrote:

> What I guess is that camel opens a connection for each invocation.  Can you
> try to use the  Spring  SingleConnectionFactory?
>    <bean id="jmsConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>       <property name="targetConnectionFactory">
>           <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>               <property name="brokerURL" value="tcp://localhost:61616" />
>           </bean>
>       </property>
>   </bean>
>
> Greetings
>
> Christian
>
> asaksena1 schrieb:
>>
>> I'm running the  Spring Remoting with JMS (@
>> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
>> loop to evaluate the Camel for my project.
>> I'm getting the following consistent error after 3922 invocations.
>>
>> Can anyone tell me what is the cause for this.
>>
>> ++++
>> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
>> occured during JMS processing; nested exception is javax.jms.JMSException:
>> Could not connect to broker URL: tcp://localhost:61616. Reason:
>> java.net.BindException: Address already in use: connect
>>        at
>>
>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>        at
>>
>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>        at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>        at
>>
>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
>>        at
>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
>>        at
>>
>> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
>> ++++
>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

jstrachan
In reply to this post by asaksena1
2008/12/4 asaksena1 <[hidden email]>:

>
> I'm running the  Spring Remoting with JMS (@
> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
> loop to evaluate the Camel for my project.
> I'm getting the following consistent error after 3922 invocations.
>
> Can anyone tell me what is the cause for this.
>
> ++++
> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
> occured during JMS processing; nested exception is javax.jms.JMSException:
> Could not connect to broker URL: tcp://localhost:61616. Reason:
> java.net.BindException: Address already in use: connect
>        at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>        at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>        at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
>        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
>        at
> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
> ++++

BTW I think this is probably a nested exception - and you're probably
not showing the real exception. AFAIK the "Address already in use"
error is when you are trying to startup another broker when one is
already bound to the socket?

As Claus says, using the ActiveMQ component with ActiveMQ ensures
efficient pooling when using Spring to avoid unnecessary socket/broker
start/stops etc
--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

asaksena1
In reply to this post by Christian Schneider
Hi Christian,

After using Spring's SingleConnectionFactory it breaks with the same exception after 3948 loops :(

-Anurag


Christian Schneider wrote
What I guess is that camel opens a connection for each invocation.  Can
you try to use the  Spring  SingleConnectionFactory?
     <bean id="jmsConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="tcp://localhost:61616" />
            </bean>
        </property>
    </bean>

Greetings

Christian

asaksena1 schrieb:
> I'm running the  Spring Remoting with JMS (@
> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
> loop to evaluate the Camel for my project.
> I'm getting the following consistent error after 3922 invocations.
>
> Can anyone tell me what is the cause for this.
>
> ++++
> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
> occured during JMS processing; nested exception is javax.jms.JMSException:
> Could not connect to broker URL: tcp://localhost:61616. Reason:
> java.net.BindException: Address already in use: connect
> at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
> at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
> at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
> at
> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
> at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
> at
> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
> ++++
>  


--

Christian Schneider
---
http://www.liquid-reality.de
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

asaksena1
In reply to this post by Claus Ibsen-2
Hi Clause,

As per the example here is what I have in my camel-server.xml

    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
               
                <property name="brokerURL" value="vm://localhost"/>
            </bean>
        </property>
    </bean>


Are you telling that I should change it to..

  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="vm://localhost"/>
  </bean>

Thanks

-Anurag

Claus Ibsen-2 wrote
Hi

Actually if you are using ActiveMQ as the broker we encourage to use
the ActiveMQComponent that is shipped with ActiveMQ itself

See this page:
http://activemq.apache.org/camel/activemq.html

So you can do this:

  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="vm://somehost"/>
  </bean>



/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Fri, Dec 5, 2008 at 8:09 AM, Christian Schneider
<chris@die-schneider.net> wrote:
> What I guess is that camel opens a connection for each invocation.  Can you
> try to use the  Spring  SingleConnectionFactory?
>    <bean id="jmsConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>       <property name="targetConnectionFactory">
>           <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>               <property name="brokerURL" value="tcp://localhost:61616" />
>           </bean>
>       </property>
>   </bean>
>
> Greetings
>
> Christian
>
> asaksena1 schrieb:
>>
>> I'm running the  Spring Remoting with JMS (@
>> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
>> loop to evaluate the Camel for my project.
>> I'm getting the following consistent error after 3922 invocations.
>>
>> Can anyone tell me what is the cause for this.
>>
>> ++++
>> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
>> occured during JMS processing; nested exception is javax.jms.JMSException:
>> Could not connect to broker URL: tcp://localhost:61616. Reason:
>> java.net.BindException: Address already in use: connect
>>        at
>>
>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>        at
>>
>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>        at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>        at
>>
>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
>>        at
>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
>>        at
>>
>> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
>> ++++
>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

asaksena1
In reply to this post by Claus Ibsen-2
I tried the way you suggested and it even works with 100K successive invokations now.
Thanks a lot !!

-a.


Claus Ibsen-2 wrote
Hi

Actually if you are using ActiveMQ as the broker we encourage to use
the ActiveMQComponent that is shipped with ActiveMQ itself

See this page:
http://activemq.apache.org/camel/activemq.html

So you can do this:

  <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="vm://somehost"/>
  </bean>



/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Fri, Dec 5, 2008 at 8:09 AM, Christian Schneider
<chris@die-schneider.net> wrote:
> What I guess is that camel opens a connection for each invocation.  Can you
> try to use the  Spring  SingleConnectionFactory?
>    <bean id="jmsConnectionFactory"
> class="org.springframework.jms.connection.SingleConnectionFactory">
>       <property name="targetConnectionFactory">
>           <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>               <property name="brokerURL" value="tcp://localhost:61616" />
>           </bean>
>       </property>
>   </bean>
>
> Greetings
>
> Christian
>
> asaksena1 schrieb:
>>
>> I'm running the  Spring Remoting with JMS (@
>> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
>> loop to evaluate the Camel for my project.
>> I'm getting the following consistent error after 3922 invocations.
>>
>> Can anyone tell me what is the cause for this.
>>
>> ++++
>> org.springframework.jms.UncategorizedJmsException: Uncategorized exception
>> occured during JMS processing; nested exception is javax.jms.JMSException:
>> Could not connect to broker URL: tcp://localhost:61616. Reason:
>> java.net.BindException: Address already in use: connect
>>        at
>>
>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>        at
>>
>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>        at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>        at
>>
>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
>>        at
>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
>>        at
>>
>> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
>> ++++
>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Claus Ibsen-2
Hi

Glad it works with such a high number.

Hope the remaining of your Camel riders is more easier.
But feel free to keep asking at these forums.



On Wed, Dec 10, 2008 at 4:33 PM, asaksena1 <[hidden email]> wrote:

>
> I tried the way you suggested and it even works with 100K successive
> invokations now.
> Thanks a lot !!
>
> -a.
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Actually if you are using ActiveMQ as the broker we encourage to use
>> the ActiveMQComponent that is shipped with ActiveMQ itself
>>
>> See this page:
>> http://activemq.apache.org/camel/activemq.html
>>
>> So you can do this:
>>
>>   <bean id="jms"
>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>     <property name="brokerURL" value="vm://somehost"/>
>>   </bean>
>>
>>
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>>
>> On Fri, Dec 5, 2008 at 8:09 AM, Christian Schneider
>> <[hidden email]> wrote:
>>> What I guess is that camel opens a connection for each invocation.  Can
>>> you
>>> try to use the  Spring  SingleConnectionFactory?
>>>    <bean id="jmsConnectionFactory"
>>> class="org.springframework.jms.connection.SingleConnectionFactory">
>>>       <property name="targetConnectionFactory">
>>>           <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>>               <property name="brokerURL" value="tcp://localhost:61616" />
>>>           </bean>
>>>       </property>
>>>   </bean>
>>>
>>> Greetings
>>>
>>> Christian
>>>
>>> asaksena1 schrieb:
>>>>
>>>> I'm running the  Spring Remoting with JMS (@
>>>> http://activemq.apache.org/camel/tutorial-jmsremoting.html) example in a
>>>> loop to evaluate the Camel for my project.
>>>> I'm getting the following consistent error after 3922 invocations.
>>>>
>>>> Can anyone tell me what is the cause for this.
>>>>
>>>> ++++
>>>> org.springframework.jms.UncategorizedJmsException: Uncategorized
>>>> exception
>>>> occured during JMS processing; nested exception is
>>>> javax.jms.JMSException:
>>>> Could not connect to broker URL: tcp://localhost:61616. Reason:
>>>> java.net.BindException: Address already in use: connect
>>>>        at
>>>>
>>>> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
>>>>        at
>>>>
>>>> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
>>>>        at
>>>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
>>>>        at
>>>>
>>>> org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:173)
>>>>        at
>>>> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)
>>>>        at
>>>>
>>>> org.apache.camel.component.bean.CamelInvocationHandler.invoke(CamelInvocationHandler.java:54)
>>>> ++++
>>>>
>>>
>>>
>>> --
>>>
>>> Christian Schneider
>>> ---
>>> http://www.liquid-reality.de
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/JMS-error-after-3922-invokations-%28Spring-JMS%29-tp20843426s22882p20937574.html
> Sent from the Camel - Development mailing list archive at Nabble.com.
>
>



--

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
Hi Claus,

if it worked with the ActiveMQComponent but not with the JMSComponent
then do we have a bug in the JMSComponent?

Greetings

Christian

Claus Ibsen schrieb:
> Hi
>
> Glad it works with such a high number.
>
> Hope the remaining of your Camel riders is more easier.
> But feel free to keep asking at these forums.
>
>  


--

Christian Schneider
---
http://www.liquid-reality.de

Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

jstrachan
2008/12/10 Christian Schneider <[hidden email]>:
> Hi Claus,
>
> if it worked with the ActiveMQComponent but not with the JMSComponent then
> do we have a bug in the JMSComponent?

No - its that using the JMSComponent with a 'naked'
ActiveMQConnectionFactory does absolutely no pooling whatsoever -
causing a new connection/session/producer/consumer to be created for
every single message being sent/received which is bad...

see
http://activemq.apache.org/jmstemplate-gotchas.html

So I'd recommend never using JMSComponent if you are using ActiveMQ;
we've specifically made the ActiveMQComponent so it does things right
out of the box so you don't mess up :)

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
Hi James,

Anurag tried to use the JMSComponent with the spring
SingleConnectionFactory. This should ensure that only one connection is
used.
So I would not expect that such an error should happen. In any case I
fear that this problem could also happen with other jms providers that
do not have a special module in Camel.

Greetings

Christian

James Strachan schrieb:

> 2008/12/10 Christian Schneider <[hidden email]>:
>  
>> Hi Claus,
>>
>> if it worked with the ActiveMQComponent but not with the JMSComponent then
>> do we have a bug in the JMSComponent?
>>    
>
> No - its that using the JMSComponent with a 'naked'
> ActiveMQConnectionFactory does absolutely no pooling whatsoever -
> causing a new connection/session/producer/consumer to be created for
> every single message being sent/received which is bad...
>
> see
> http://activemq.apache.org/jmstemplate-gotchas.html
>
> So I'd recommend never using JMSComponent if you are using ActiveMQ;
> we've specifically made the ActiveMQComponent so it does things right
> out of the box so you don't mess up :)
>
>  


--

Christian Schneider
---
http://www.liquid-reality.de

Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

jstrachan
2008/12/10 Christian Schneider <[hidden email]>:
> Hi James,
>
> Anurag tried to use the JMSComponent with the spring
> SingleConnectionFactory. This should ensure that only one connection is
> used.

But it still creates a brand new Session and then either a Producer or
Consumer - then closes them all down for every single message.

> So I would not expect that such an error should happen. In any case I fear
> that this problem could also happen with other jms providers that
> do not have a special module in Camel.

When using JMS you should always be careful about pooling to avoid
using it very inefficiently.

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
James Strachan schrieb:

> 2008/12/10 Christian Schneider <[hidden email]>:
>  
>> Hi James,
>>
>> Anurag tried to use the JMSComponent with the spring
>> SingleConnectionFactory. This should ensure that only one connection is
>> used.
>>    
>
> But it still creates a brand new Session and then either a Producer or
> Consumer - then closes them all down for every single message.
>  
According to the JMS spec a session is a short lived object that should
not cause any harm when being created every time. I don´t know about a
producer though.

For the consumer part I have written a quite efficient solution for the
Apache cxf jms transport. It uses a DefaultMessageListenerContainer. So
the consumer is created only once.
Perhaps this can also be done for Camel. On the producer side I had no
such solution though. I did some load tests with the cxf implementation
and had no problems with ActiveMQ.

All in all I think it is not so good that camel uses a special component
for ActiveMQ as the problem is existent for every jms provider and
should be solved in a general way.

Greetings

Christian

>  
>> So I would not expect that such an error should happen. In any case I fear
>> that this problem could also happen with other jms providers that
>> do not have a special module in Camel.
>>    
>
> When using JMS you should always be careful about pooling to avoid
> using it very inefficiently.
>
>  


--

Christian Schneider
---
http://www.liquid-reality.de

Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

jstrachan
2008/12/10 Christian Schneider <[hidden email]>:

> James Strachan schrieb:
>> 2008/12/10 Christian Schneider <[hidden email]>:
>>
>>>
>>> Hi James,
>>>
>>> Anurag tried to use the JMSComponent with the spring
>>> SingleConnectionFactory. This should ensure that only one connection is
>>> used.
>>>
>>
>> But it still creates a brand new Session and then either a Producer or
>> Consumer - then closes them all down for every single message.
>>
>
> According to the JMS spec a session is a short lived object that should not
> cause any harm when being created every time.

Where did you read that BTW? :)


> I don´t know about a producer
> though.

Producer and consumer are not that cheap to create; to be compliant
with the JMS spec a provider typically needs to make a remote
procedure call (e.g. to confirm if you are allowed to produce/consume
on that destination).

More details here...
http://activemq.apache.org/how-do-i-use-jms-efficiently.html


> For the consumer part I have written a quite efficient solution for the
> Apache cxf jms transport. It uses a DefaultMessageListenerContainer. So the
> consumer is created only once.

Good stuff.


> Perhaps this can also be done for Camel.

It was about a year ago :) We use Springs MessageListenerContainer for
consuming and JmsTemplate for sending in Camel - we always have.

The main issue with the Spring abstractions is for sending; unless you
are using a JMS pool of some kind, the producer is gonna be very
inefficient and network chatty. e.g. 3 RMI calls to do a single send
(create producer, send message, close producer) :)


> On the producer side I had no such
> solution though. I did some load tests with the cxf implementation and had
> no problems with ActiveMQ.
>
> All in all I think it is not so good that camel uses a special component for
> ActiveMQ as the problem is existent for every jms provider and should be
> solved in a general way.

The general solution is to configure things correctly - so use
whatever JMS pool is most appropriate to your JMS provider. Since few
users ever even know what the right way to setup JMS connection
factories for use with Spring's JmsTemplate and
MessageListenerContainer classes we do it all for you for ActiveMQ in
the ActiveMQComponent - letting you just focus on the one thing you're
probably gonna want to configure - the brokerURL.

Indeed you don't even have to configure the ActiveMQComponent at all!
Just send to "activemq:SomeQueue" and it'll do the right thing for
most use cases with zero configuration!

There's no magic in the ActiveMQComponent - we're just following
convention over configuration so users don't have to cut and paste a 2
page blob of XML to be able to use Camel and ActiveMQ efficiently
together. You can easily do the same kind of thing with any other JMS
provider and the JMSComponent directly - it just takes more
configuration code.

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
James Strachan schrieb:
>
>> According to the JMS spec a session is a short lived object that should not
>> cause any harm when being created every time.
>>    
>
> Where did you read that BTW? :)
>
>
>  
This was what I had remembered from the jms spec. I just reread the
chapter ... It says a session is a lightweight object.
I guess I had interpreted this into it ;-) So I must correct myself.

> It was about a year ago :) We use Springs MessageListenerContainer for
> consuming and JmsTemplate for sending in Camel - we always have.
>  
I just looked into the source. So you are also using a
MessageListenerContainer for request / reply. When I wrote the CXF jms
code I tried to figure out how you do this but did not
understand the concept of the future holder. Now that I have written
something similar I finally understood it ;-)


> The main issue with the Spring abstractions is for sending; unless you
> are using a JMS pool of some kind, the producer is gonna be very
> inefficient and network chatty. e.g. 3 RMI calls to do a single send
> (create producer, send message, close producer) :)
>  
Hmm ... do you have any idea how to cope with that? Are there best
practices for the different jms providers which pooling
works best? I think there should be some informations for people who use
other jms providers than camel.

>  
>> On the producer side I had no such
>> solution though. I did some load tests with the cxf implementation and had
>> no problems with ActiveMQ.
>>
>> All in all I think it is not so good that camel uses a special component for
>> ActiveMQ as the problem is existent for every jms provider and should be
>> solved in a general way.
>>    
>
> The general solution is to configure things correctly - so use
> whatever JMS pool is most appropriate to your JMS provider. Since few
> users ever even know what the right way to setup JMS connection
> factories for use with Spring's JmsTemplate and
> MessageListenerContainer classes we do it all for you for ActiveMQ in
> the ActiveMQComponent - letting you just focus on the one thing you're
> probably gonna want to configure - the brokerURL.
>
> Indeed you don't even have to configure the ActiveMQComponent at all!
> Just send to "activemq:SomeQueue" and it'll do the right thing for
> most use cases with zero configuration!
>
> There's no magic in the ActiveMQComponent - we're just following
> convention over configuration so users don't have to cut and paste a 2
> page blob of XML to be able to use Camel and ActiveMQ efficiently
> together. You can easily do the same kind of thing with any other JMS
> provider and the JMSComponent directly - it just takes more
> configuration code.
>
>  
Ok so if I understand you right it is only a configuration issue. I
always thought the activemq component would have a different codebase
from the jms component.
So I was quite reluctant to use it. Thanks for the clarification.

Btw. I just searched the activemq component in the camel sources and did
not find it. Is it not in the components directory?

Greetings

Christian
Reply | Threaded
Open this post in threaded view
|

Re: JMS error after 3922 invokations (Spring-JMS)

Christian Schneider
Christian Schneider schrieb:
>
>
> Btw. I just searched the activemq component in the camel sources and
> did not find it. Is it not in the components directory?
>
Well I often say the documentation is the worst part of camel. But in
this case reading the component doc would have helped ;-)
It is deployed with activemq.

http://activemq.apache.org/camel/activemq.html

Greetings

Christian