You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by JonFields <Jo...@gmail.com> on 2016/02/11 17:22:47 UTC
ActiveMQ Component and Connection Pooling not working
Camel Version: 2.16.0
ActiveMQ version: 5.13.0
Container/Environment: Karaf 4.0.4/Blueprint
I tried the example for connection pooling here, using Blueprint and
deploying to Karaf:
http://camel.apache.org/activemq.html
Here is my blueprint.xml. The RouteBuilder class just does a
from("activemq:test").to("log:test"); Note that ActiveMQ is running on the
host "s4", NOT "localhost" where Karaf is running.
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://s4:61616" />
<property name="userName" value="admin" />
<property name="password" value="admin" />
</bean>
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="concurrentConsumers" value="10" />
</bean>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<bean id="routeBuilder" class="test.RouteBuilder">
</bean>
<camelContext id="test-activemq-routes"
xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="routeBuilder" />
</camelContext>
</blueprint>
When the bundle is started in Karaf, it hangs forever, with the ActiveMQ
client trying to connect to
tcp://localhost:61616
NOT
tcp://s4:61616
as specified above. So apparently the ConnectionFactory that is being passed
is somehow being ignored.
If I used the following blueprint.xml, specifying the ActiveMQ URL,
username, and password directly to the ActiveMQComponent, it works fine - it
correctly connects to the remote ActiveMQ server on the "s4" server.
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://s4:61616" />
<property name="userName" value="admin" />
<property name="password" value="admin" />
</bean>
<bean id="routeBuilder"
class="edu.usc.ucm.test_activemq_routes.RouteBuilder">
</bean>
<camelContext id="test-activemq-routes"
xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="routeBuilder" />
</camelContext>
</blueprint>
Is this a bug, is the documentation wrong, or am I doing something wrong?
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-Component-and-Connection-Pooling-not-working-tp5777608.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ActiveMQ Component and Connection Pooling not working
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Have you tried changing <bean id=“activemq” …> to something like <bean id=“my-activemq” …> and then using from(“my-activemq:test”)?
> On Feb 11, 2016, at 9:22 AM, JonFields <Jo...@gmail.com> wrote:
>
> Camel Version: 2.16.0
> ActiveMQ version: 5.13.0
> Container/Environment: Karaf 4.0.4/Blueprint
>
> I tried the example for connection pooling here, using Blueprint and
> deploying to Karaf:
>
> http://camel.apache.org/activemq.html
>
> Here is my blueprint.xml. The RouteBuilder class just does a
> from("activemq:test").to("log:test"); Note that ActiveMQ is running on the
> host "s4", NOT "localhost" where Karaf is running.
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>
> <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL" value="tcp://s4:61616" />
> <property name="userName" value="admin" />
> <property name="password" value="admin" />
> </bean>
>
> <bean id="pooledConnectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory"
> init-method="start" destroy-method="stop">
> <property name="maxConnections" value="8" />
> <property name="connectionFactory" ref="jmsConnectionFactory" />
> </bean>
>
> <bean id="jmsConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
> <property name="connectionFactory" ref="pooledConnectionFactory" />
> <property name="concurrentConsumers" value="10" />
> </bean>
>
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
> <property name="configuration" ref="jmsConfig" />
> </bean>
>
> <bean id="routeBuilder" class="test.RouteBuilder">
> </bean>
>
> <camelContext id="test-activemq-routes"
> xmlns="http://camel.apache.org/schema/blueprint">
> <routeBuilder ref="routeBuilder" />
> </camelContext>
>
> </blueprint>
>
> When the bundle is started in Karaf, it hangs forever, with the ActiveMQ
> client trying to connect to
>
> tcp://localhost:61616
>
> NOT
>
> tcp://s4:61616
>
> as specified above. So apparently the ConnectionFactory that is being passed
> is somehow being ignored.
>
> If I used the following blueprint.xml, specifying the ActiveMQ URL,
> username, and password directly to the ActiveMQComponent, it works fine - it
> correctly connects to the remote ActiveMQ server on the "s4" server.
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
> <property name="brokerURL" value="tcp://s4:61616" />
> <property name="userName" value="admin" />
> <property name="password" value="admin" />
> </bean>
>
> <bean id="routeBuilder"
> class="edu.usc.ucm.test_activemq_routes.RouteBuilder">
> </bean>
>
> <camelContext id="test-activemq-routes"
> xmlns="http://camel.apache.org/schema/blueprint">
> <routeBuilder ref="routeBuilder" />
> </camelContext>
>
> </blueprint>
>
> Is this a bug, is the documentation wrong, or am I doing something wrong?
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQ-Component-and-Connection-Pooling-not-working-tp5777608.html
> Sent from the Camel - Users mailing list archive at Nabble.com.