camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: JMS persistence options have no effect
Date Wed, 19 Dec 2012 21:36:44 GMT
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 <davidkarlsen@gmail.com>wrote:

> explicitQos




--

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message