You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Müller <ch...@gmail.com> on 2012/12/03 00:31:40 UTC
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
I tried to reproduce your issue with the following test - without look
(using Camel 2.10.2 and ActiveMQ 5.7.0):
- 10 parallel producer
- each will send 200 messages
- 5 consumers total
public class CamelJmsSharedFixReplyQueueTest extends CamelSpringTestSupport
{
private int senderCount = 10;
@Test
public void test() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(senderCount);
ExecutorService executor = Executors.newCachedThreadPool();
for (int i = 0; i < senderCount; i++) {
executor.execute(new Sender(context, latch));
}
assertTrue(latch.await(30, TimeUnit.SECONDS));
}
@Override
protected AbstractApplicationContext createApplicationContext() {
return new
ClassPathXmlApplicationContext("META-INF/spring/camel-jms-consumer.xml");
}
public static class Sender implements Runnable {
private int messagePerSenderCount = 200;
private CamelContext context;
private CountDownLatch latch;
public Sender(CamelContext context, CountDownLatch latch) {
this.context = context;
this.latch = latch;
}
@Override
public void run() {
ProducerTemplate template = context.createProducerTemplate();
template.setDefaultEndpointUri("activemq:ORDER_ENTRY?replyTo=ORDER_ENTRY.REPLY&receiveTimeout=200");
for (int i = 0; i < messagePerSenderCount; i++) {
Object response = template.requestBody("Camel");
assertEquals("Hello Camel", response);
}
latch.countDown();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="broker" class="org.apache.activemq.broker.BrokerService"
init-method="start" destroy-method="stop">
<property name="persistent" value="false" />
<property name="transportConnectorURIs">
<list>
<value>tcp://localhost:61616</value>
</list>
</property>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" disabled="true"/>
<route>
<from uri="activemq:ORDER_ENTRY?concurrentConsumers=5" />
<transform><simple>Hello ${body}</simple></transform>
</route>
</camelContext>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<bean id="connectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
depends-on="broker">
<property name="maxConnections" value="10" />
<property name="maximumActive" value="500" />
<property name="connectionFactory">
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</property>
</bean>
</beans>
Can you tell me where your set up is different?
Best,
Christian
On Fri, Nov 16, 2012 at 10:50 AM, anaCortes <an...@hotmail.com> wrote:
> PooledConnectionFactory seems not to cache MessageConsumers. Then, the next
> configuration would be the same idea?
>
> PooledConnectionFactory == CachingConnectionFactory+cacheConsumers=false
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5722847.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by anaCortes <an...@hotmail.com>.
PooledConnectionFactory is in 5.5.1 but with the bug:
https://issues.apache.org/jira/browse/CAMEL-4657 and this was affecting us.
For that, i said it would be good for us if we can upgrade to AMQ 5.7 :)
If we cannot do it, we will see the Claus´ idea about using FuseSource
ActiveMQ
distributions :)
Best regards,
Ana
--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723887.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 6, 2012 at 2:45 PM, anaCortes <an...@hotmail.com> wrote:
> Hi Scott,
>
> thank you for your answer, it´s really interesting :)
>
> Then we should use PooledConnectionFactory and for that we need to upgrade
> also AMQ to 5.7.0.
>
You could either try to fix the leaks by backporting the patches and
rebuild a 5.5.1 release with these fixes yourself.
That said, you can also consider trying the FuseSource ActiveMQ
distributions of 5.5.x as we backport and stabilize these releases
for a longer time than at ASF.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723705.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Christian Müller <ch...@gmail.com>.
org.apache.activemq.pool.PooledConnectionFactory is also available in
ActiveMQ 5.5.1.
Best,
Christian
On Thu, Dec 6, 2012 at 2:45 PM, anaCortes <an...@hotmail.com> wrote:
> Hi Scott,
>
> thank you for your answer, it´s really interesting :)
>
> Then we should use PooledConnectionFactory and for that we need to upgrade
> also AMQ to 5.7.0.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723705.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by anaCortes <an...@hotmail.com>.
Hi Scott,
thank you for your answer, it´s really interesting :)
Then we should use PooledConnectionFactory and for that we need to upgrade
also AMQ to 5.7.0.
--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723705.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Scott England-Sullivan <su...@gmail.com>.
Two comments:
One, the ActiveMQ Camel Component wraps the connection factory in an
ActiveMQ PooledConnectionFactory. My first reaction would be that this
would produce a less than predictable result. Both the AMQ PCF and the
Spring CCF are trying to manage pools and sessions. Very unpredictable.
You could disable it on the component but I would suggest to eliminate the
use of the Spring CCF and just use the capabilities already present in the
AMQ Camel component.
Two, the CachingConnectionFactory & the ActiveMQConnectionFactory have a
history of not playing well with each other in the area of failure
management. If you are using AMQ failover protocols, you have to be very
careful in how you configure the Spring CCF.
Best Regards,
Scott ES
On Wed, Dec 5, 2012 at 3:55 PM, Christian Müller <
christian.mueller@gmail.com> wrote:
> It works also with the following configuration:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
> <bean id="broker" class="org.apache.activemq.broker.BrokerService"
> init-method="start" destroy-method="stop">
> <property name="persistent" value="false" />
> <property name="transportConnectorURIs">
> <list>
> <value>tcp://localhost:61616</value>
> </list>
> </property>
> </bean>
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
> <jmxAgent id="agent" disabled="true"/>
>
> <route>
> <from uri="activemq:ORDER_ENTRY?concurrentConsumers=5" />
> <transform><simple>Hello ${body}</simple></transform>
> </route>
> </camelContext>
>
> <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
> <property name="connectionFactory" ref="connectionFactory" />
> </bean>
>
> <bean id="connectionFactory"
> class="org.springframework.jms.connection.CachingConnectionFactory">
> <property name="targetConnectionFactory"
> ref="activeMQConnectionFactory" />
> <property name="sessionCacheSize" value="100" />
> <property name="cacheConsumers" value="false" />
> </bean>
>
> <bean id="activeMQConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
> <property name="brokerURL" value="tcp://localhost:61616" />
> </bean>
> </beans>
>
> If I set cacheConsumers to true, it works too.
>
> Best,
> Christian
>
> On Mon, Dec 3, 2012 at 3:09 PM, anaCortes <an...@hotmail.com> wrote:
>
> > Hi,
> >
> > my problematic configuration had CachingConnectionFactory (with
> > cacheConsumers true by default) and not PooledConnectionFactory.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723546.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
--
--
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web: fusesource.com <http://www.fusesource.com> |
redhat.com<http://www.redhat.com>
Blog: sully6768.blogspot.com
Twitter: sully6768
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Christian Müller <ch...@gmail.com>.
As I wrote, I couldn't reproduce the issue with your provided unit test. My
unit tests also works fine.
Any unit test which shows this issue would be great.
Best,
Christian
On Tue, Dec 11, 2012 at 9:52 AM, anaCortes <an...@hotmail.com> wrote:
> > The test works also with CachingConnectionFactory and ActiveMQ 5.5.1.
> > Could you update the test so that it will show your issue? Otherwise I'm
> > not sure whether we can find and resolve your issue.
>
> Using cacheConsumers=false with CachingConnectionFactory solved our
> problem,
> and if we can change in the close future to AMQ 5.7, we will change
> CachingConnectionFactory to PooledConnectionFactory.
>
> Should this reply queue problem be working also with cacheConsumers=true?
> Then what test should i update to trying solve this problem, the test i
> did?
> :)
>
> Best regards,
> Ana
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723888.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by anaCortes <an...@hotmail.com>.
> The test works also with CachingConnectionFactory and ActiveMQ 5.5.1.
> Could you update the test so that it will show your issue? Otherwise I'm
> not sure whether we can find and resolve your issue.
Using cacheConsumers=false with CachingConnectionFactory solved our problem,
and if we can change in the close future to AMQ 5.7, we will change
CachingConnectionFactory to PooledConnectionFactory.
Should this reply queue problem be working also with cacheConsumers=true?
Then what test should i update to trying solve this problem, the test i did?
:)
Best regards,
Ana
--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723888.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Christian Müller <ch...@gmail.com>.
The test works also with CachingConnectionFactory and ActiveMQ 5.5.1.
Could you update the test so that it will show your issue? Otherwise I'm
not sure whether we can find and resolve your issue.
Best,
Christian
On Thu, Dec 6, 2012 at 2:34 PM, anaCortes <an...@hotmail.com> wrote:
> Have you tried also with ActiveMQ 5.5.1? Right now, we are using this
> version
> and we are not allowed to upgrade the AMQ version.
> In the end, we should do this because 5.5.1 has a memory leaks bug that has
> occasioned us some pain ;)
>
> Best regards,
> Ana
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723704.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by anaCortes <an...@hotmail.com>.
Have you tried also with ActiveMQ 5.5.1? Right now, we are using this version
and we are not allowed to upgrade the AMQ version.
In the end, we should do this because 5.5.1 has a memory leaks bug that has
occasioned us some pain ;)
Best regards,
Ana
--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723704.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by Christian Müller <ch...@gmail.com>.
It works also with the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="broker" class="org.apache.activemq.broker.BrokerService"
init-method="start" destroy-method="stop">
<property name="persistent" value="false" />
<property name="transportConnectorURIs">
<list>
<value>tcp://localhost:61616</value>
</list>
</property>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" disabled="true"/>
<route>
<from uri="activemq:ORDER_ENTRY?concurrentConsumers=5" />
<transform><simple>Hello ${body}</simple></transform>
</route>
</camelContext>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory"
ref="activeMQConnectionFactory" />
<property name="sessionCacheSize" value="100" />
<property name="cacheConsumers" value="false" />
</bean>
<bean id="activeMQConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</beans>
If I set cacheConsumers to true, it works too.
Best,
Christian
On Mon, Dec 3, 2012 at 3:09 PM, anaCortes <an...@hotmail.com> wrote:
> Hi,
>
> my problematic configuration had CachingConnectionFactory (with
> cacheConsumers true by default) and not PooledConnectionFactory.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723546.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: JMS - Shared fixed reply queue doesn´t consume all the messages
Posted by anaCortes <an...@hotmail.com>.
Hi,
my problematic configuration had CachingConnectionFactory (with
cacheConsumers true by default) and not PooledConnectionFactory.
--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Shared-fixed-reply-queue-doesn-t-consume-all-the-messages-tp5721700p5723546.html
Sent from the Camel - Users mailing list archive at Nabble.com.