You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by brking <br...@gmail.com> on 2012/12/10 01:56:23 UTC

JMS persistence options have no effect

Hi I'm using Camel 2.8, working with request reply over JMS via ActiveMQ. I
can't seem to get a non-persistent request/reply to work without actually
adding persistent="false" to the ActiveMQ broker element in activemq.xml.
This is not desirable to have all persistence disabled. The follwing options
on the uri seem to have no effect:

deliveryPersistent=false
replyToDeliveryPersistent=false

I really want to disable persistence just for request/reply. For my
application I am getting 100K messages per minute without persistence, and
only 25K with the ActiveMQ throughput optimized persistence configuration.

I may be doing something wrong, but it seems like this is pretty
straightforward from the documentation. Thanks for any help.



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-persistence-options-have-no-effect-tp5723805.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS persistence options have no effect

Posted by Christian Müller <ch...@gmail.com>.
Thanks David!

I updated the example and set "explicitQosEnabled" on both endpoint
configurations. Now it works as expected! Thanks!

@Brad: I hope this will also solve your issue.

import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.camel.component.ActiveMQComponent;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class CamelActiveMQConsumerPersistentIssueTest extends
CamelTestSupport {

    private BrokerService broker;

    @Before
    public void setUp() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(true);
        broker.setUseJmx(false);
        broker.addConnector("tcp://localhost:61616");
        broker.start();

        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();

        broker.stop();
    }

    @Test
    public void test() throws Exception {
        // 1 = NON_PERSISTENT
        // 2 = PERSISTENT

        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {

from("activemq:queue:test?replyToDeliveryPersistent=false&explicitQosEnabled=true")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws
Exception {
                            assertEquals(Integer.valueOf(1),
exchange.getIn().getHeader("JMSDeliveryMode", Integer.class));
                            exchange.getOut().setBody("Camel");
                        }
                    });
            }
        });

        Exchange ex =
template.request("activemq:queue:test?deliveryPersistent=false&explicitQosEnabled=true",
new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody("What's the best integration
framework?");
            }
        });

        assertEquals("Camel", ex.getOut().getBody(String.class));
        assertEquals(Integer.valueOf(1),
ex.getOut().getHeader("JMSDeliveryMode", Integer.class));
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = super.createRegistry();
        registry.bind("activemq",
ActiveMQComponent.activeMQComponent("failover:(tcp://localhost:61616)"));
        return registry;
    }
}

Best,
Christian

On Mon, Dec 17, 2012 at 6:55 PM, David Karlsen <da...@gmail.com>wrote:

> explicitQos




--

Re: JMS persistence options have no effect

Posted by David Karlsen <da...@gmail.com>.
Haven't followed the thread very close, but be sure to enable
explicitQos for these flags to kick in
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/core/JmsTemplate.html#isExplicitQosEnabled()
http://camel.apache.org/jms.html


2012/12/17 Christian Müller <ch...@gmail.com>:
> I tried this too, but it doesn't work neither:
>
> public class CamelActiveMQConsumerPersistentIssueTest extends
> CamelTestSupport {
>
>     private BrokerService broker;
>
>     @Before
>     public void setUp() throws Exception {
>         broker = new BrokerService();
>         broker.setPersistent(true);
>         broker.setUseJmx(false);
>         broker.addConnector("tcp://localhost:61616");
>         broker.start();
>
>         super.setUp();
>     }
>
>     @After
>     public void tearDown() throws Exception {
>         super.tearDown();
>
>         broker.stop();
>     }
>
>     @Test
>     public void test() throws Exception {
>         // 1 = NON_PERSISTENT
>         // 2 = PERSISTENT
>
>         context.addRoutes(new RouteBuilder() {
>             public void configure() throws Exception {
>                 from("activemq:queue:test?replyToDeliveryPersistent=false")
>                     .process(new Processor() {
>                         public void process(Exchange exchange) throws
> Exception {
>                             assertEquals(Integer.valueOf(1),
> exchange.getIn().getHeader("JMSDeliveryMode", Integer.class));
>                             exchange.getOut().setBody("Camel");
>                         }
>                     });
>             }
>         });
>
>         Exchange ex =
> template.request("activemq:queue:test?deliveryPersistent=false", new
> Processor() {
>             public void process(Exchange exchange) throws Exception {
>                 exchange.getIn().setBody("What's the best integration
> framework?");
>             }
>         });
>
>         assertEquals("Camel", ex.getOut().getBody(String.class));
>         assertEquals(Integer.valueOf(1),
> ex.getOut().getHeader("JMSDeliveryMode", Integer.class));
>     }
>
>     @Override
>     protected JndiRegistry createRegistry() throws Exception {
>         JndiRegistry registry = super.createRegistry();
>         registry.bind("activemq",
> ActiveMQComponent.activeMQComponent("failover:(tcp://localhost:61616)"));
>         return registry;
>     }
> }
>
> Best,
> Christian
>
> On Sat, Dec 15, 2012 at 10:50 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> replyToDeliveryPersistent is on the consumer side as I understand it.
>>
>>
>>
>>
>> On Fri, Dec 14, 2012 at 10:27 PM, Christian Müller
>> <ch...@gmail.com> wrote:
>> > replyToDeliveryPersistent
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Re: JMS persistence options have no effect

Posted by Christian Müller <ch...@gmail.com>.
I tried this too, but it doesn't work neither:

public class CamelActiveMQConsumerPersistentIssueTest extends
CamelTestSupport {

    private BrokerService broker;

    @Before
    public void setUp() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(true);
        broker.setUseJmx(false);
        broker.addConnector("tcp://localhost:61616");
        broker.start();

        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();

        broker.stop();
    }

    @Test
    public void test() throws Exception {
        // 1 = NON_PERSISTENT
        // 2 = PERSISTENT

        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                from("activemq:queue:test?replyToDeliveryPersistent=false")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws
Exception {
                            assertEquals(Integer.valueOf(1),
exchange.getIn().getHeader("JMSDeliveryMode", Integer.class));
                            exchange.getOut().setBody("Camel");
                        }
                    });
            }
        });

        Exchange ex =
template.request("activemq:queue:test?deliveryPersistent=false", new
Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody("What's the best integration
framework?");
            }
        });

        assertEquals("Camel", ex.getOut().getBody(String.class));
        assertEquals(Integer.valueOf(1),
ex.getOut().getHeader("JMSDeliveryMode", Integer.class));
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = super.createRegistry();
        registry.bind("activemq",
ActiveMQComponent.activeMQComponent("failover:(tcp://localhost:61616)"));
        return registry;
    }
}

Best,
Christian

On Sat, Dec 15, 2012 at 10:50 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> replyToDeliveryPersistent is on the consumer side as I understand it.
>
>
>
>
> On Fri, Dec 14, 2012 at 10:27 PM, Christian Müller
> <ch...@gmail.com> wrote:
> > replyToDeliveryPersistent
>
>
>
> --
> 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 persistence options have no effect

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

replyToDeliveryPersistent is on the consumer side as I understand it.




On Fri, Dec 14, 2012 at 10:27 PM, Christian Müller
<ch...@gmail.com> wrote:
> replyToDeliveryPersistent



-- 
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 persistence options have no effect

Posted by Christian Müller <ch...@gmail.com>.
How did you test this?
I set up a small example which shows that the deliveryPersistent option
works. However, it looks like the replyToDeliveryPersistent option has no
effect (with Camel 2.8.0 and also Camel 2.10.2). It's delivered persistent
independent from the configuration.
Maybe an ActiveMQ expert could have a look at it!?

public class CamelActiveMQConsumerPersistentIssueTest extends
CamelTestSupport {

    private BrokerService broker;

    @Before
    public void setUp() throws Exception {
        broker = new BrokerService();
        broker.setPersistent(true);
        broker.setUseJmx(false);
        broker.addConnector("tcp://localhost:61616");
        broker.start();

        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();

        broker.stop();
    }

    @Test
    public void test() throws Exception {
        // 1 = NON_PERSISTENT
        // 2 = PERSISTENT

        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                from("activemq:queue:test")
                    .process(new Processor() {
                        public void process(Exchange exchange) throws
Exception {
                            assertEquals(Integer.valueOf(1),
exchange.getIn().getHeader("JMSDeliveryMode", Integer.class));
                            exchange.getOut().setBody("Camel");
                        }
                    });
            }
        });

        Exchange ex =
template.request("activemq:queue:test?deliveryPersistent=false&replyToDeliveryPersistent=false",
new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setBody("What's the best integration
framework?");
            }
        });

        assertEquals("Camel", ex.getOut().getBody(String.class));
        assertEquals(Integer.valueOf(2),
ex.getOut().getHeader("JMSDeliveryMode", Integer.class));
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry registry = super.createRegistry();
        registry.bind("activemq",
ActiveMQComponent.activeMQComponent("failover:(tcp://localhost:61616)"));
        return registry;
    }
}

Best,
Christian

On Mon, Dec 10, 2012 at 2:43 AM, brking <br...@gmail.com> wrote:

> I'm not sure what configuration you mean. These are just options I'm using
> on
> the uri I'm providing to requestBody on the producer template per the camel
> jms documentation.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-persistence-options-have-no-effect-tp5723805p5723808.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Re: JMS persistence options have no effect

Posted by brking <br...@gmail.com>.
I'm not sure what configuration you mean. These are just options I'm using on
the uri I'm providing to requestBody on the producer template per the camel
jms documentation.



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-persistence-options-have-no-effect-tp5723805p5723808.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS persistence options have no effect

Posted by Raul Kripalani <ra...@evosent.com>.
Could you please post your configuration? Otherwise it's hard to help you
out.

Thanks,
Raúl.
On 10 Dec 2012 00:56, "brking" <br...@gmail.com> wrote:

> Hi I'm using Camel 2.8, working with request reply over JMS via ActiveMQ. I
> can't seem to get a non-persistent request/reply to work without actually
> adding persistent="false" to the ActiveMQ broker element in activemq.xml.
> This is not desirable to have all persistence disabled. The follwing
> options
> on the uri seem to have no effect:
>
> deliveryPersistent=false
> replyToDeliveryPersistent=false
>
> I really want to disable persistence just for request/reply. For my
> application I am getting 100K messages per minute without persistence, and
> only 25K with the ActiveMQ throughput optimized persistence configuration.
>
> I may be doing something wrong, but it seems like this is pretty
> straightforward from the documentation. Thanks for any help.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-persistence-options-have-no-effect-tp5723805.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>