You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tom Howe <to...@artcore.com> on 2011/04/04 17:54:08 UTC

Does activemq/jms component have keepalive option?

I have a simple route that goes

from("file:/some/path").to("activemq:some/queue");

>From truss and activeMq admin page, I notice that it is constantly
connecting/closing the connections.

Is there a way to make the endpoint retain a connection to make it more
efficient?

Thanks, Tom

Re: Does activemq/jms component have keepalive option?

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Have you considered using a PooledConnectionFactory instead of the
ActiveMQConnectionFactory. This will allow you not to create fresh
connections each time.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Does-activemq-jms-component-have-keepalive-option-tp4282121p4283140.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Does activemq/jms component have keepalive option?

Posted by Tom Howe <to...@artcore.com>.
Hi,
Thanks for the pointer!  I have changed to use PooledConnectionFactory as
you suggest and it seems to work well now.

Here is my config: does it look sensible?


    <bean id="activemq" class="org.apache.activemq.
camel.component.ActiveMQComponent">
        <property name="transacted" value="true"/>
        <property name="configuration" ref="myConfigDelivery"/>
    </bean>


    <bean id="myConfigDelivery"
class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory"
ref="jmsConnectionFactoryDelivery"/>
        <property name="transactionManager"
ref="jmsTransactionManagerDelivery"/>
        <property name="concurrentConsumers" value="1"/>
        <property name="maxConcurrentConsumers" value="1"/>
        <property name="transacted" value="true"/>
    </bean>

    <bean id="jmsTransactionManagerDelivery"
class="org.springframework.jms.connection.JmsTransactionManager">
        <property name="connectionFactory"
ref="jmsConnectionFactoryDelivery"/>
    </bean>

    <bean id="activeMqConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${broker.url}"/>
        <property name="redeliveryPolicy" ref="redeliveryPolicyDelivery"/>
    </bean>

    <bean id="jmsConnectionFactoryDelivery" class="org.apache.activemq.pool.
PooledConnectionFactory">
        <property name="connectionFactory" ref="activeMqConnectionFactory"/>
    </bean>

    <bean id="redeliveryPolicyDelivery"
class="org.apache.activemq.RedeliveryPolicy">
        <property name="maximumRedeliveries" value="1000000"/>
        <property name="useExponentialBackOff" value="true"/>
        <property name="backOffMultiplier" value="5"/>
    </bean>


On Tue, Apr 5, 2011 at 10:47 AM, James Strachan <ja...@fusesource.com>wrote:

> If you don't set any ConnectionFactory on the ActiveMQ component, you
> should have pooling setup correctly which should pool a single
> connection. e.g. just set the brokerURL property on the ActiveMQ
> component.
>
> Whats your spring XML look like?
>
> On 4 April 2011 16:54, Tom Howe <to...@artcore.com> wrote:
> > I have a simple route that goes
> >
> > from("file:/some/path").to("activemq:some/queue");
> >
> > From truss and activeMq admin page, I notice that it is constantly
> > connecting/closing the connections.
> >
> > Is there a way to make the endpoint retain a connection to make it more
> > efficient?
> >
> > Thanks, Tom
> >
>
>
>
> --
> James
> -------
> FuseSource
> Email: james@fusesource.com
> Web: http://fusesource.com
> Twitter: jstrachan, fusenews
> Blog: http://macstrac.blogspot.com/
>
> Connect at CamelOne May 24-26
> The Open Source Integration Conference
> http://camelone.com/
>

Re: Does activemq/jms component have keepalive option?

Posted by James Strachan <ja...@fusesource.com>.
If you don't set any ConnectionFactory on the ActiveMQ component, you
should have pooling setup correctly which should pool a single
connection. e.g. just set the brokerURL property on the ActiveMQ
component.

Whats your spring XML look like?

On 4 April 2011 16:54, Tom Howe <to...@artcore.com> wrote:
> I have a simple route that goes
>
> from("file:/some/path").to("activemq:some/queue");
>
> From truss and activeMq admin page, I notice that it is constantly
> connecting/closing the connections.
>
> Is there a way to make the endpoint retain a connection to make it more
> efficient?
>
> Thanks, Tom
>



-- 
James
-------
FuseSource
Email: james@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/