camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: JMS error after 3922 invokations (Spring-JMS)
Date Thu, 11 Dec 2008 14:28:43 GMT
2008/12/10 Christian Schneider <chris@die-schneider.net>:
> James Strachan schrieb:
>> 2008/12/10 Christian Schneider <chris@die-schneider.net>:
>>
>>>
>>> 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/

Mime
View raw message