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/07 17:13:58 UTC

JMS Request Reply not working with temporary queues in 2.8 ?

I've been trying to get request reply working in 2.8 over JMS. I am confused
as to the following behavior:

- If I dont set a replyTo queue, requestBody() times out and I never get a
response

- If I set a replyTo queue, I get messages once per second. (I thought this
was fixed in 2.8 ?), I can improve that by setting receiveTimeout=xxx.

- If I set a replyTo queue and mark it as exclusive I get decent
performance, but was hoping for better on temporary queues.

I'd like to get temporary queues working. Is there any other requirement
other than setting exchangePattern=InOut on the Uri ? My code is very
simple:

// DOESNT WORK String uri = String.format("%s?exchangePattern=InOut",
requestQueue);

String uri =
String.format("%s?exchangePattern=InOut&replyTo=%s&replyToType=Exclusive",
requestQueue, replyQueue);

String result = (String)template.requestBody(uri, data);

I'm using ActievMQ 5.5.1 on Windows 7 64 bit.

Thank you




--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Request-Reply-not-working-with-temporary-queues-in-2-8-tp5723771.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Request Reply not working with temporary queues in 2.8 ?

Posted by Christian Müller <ch...@gmail.com>.
It makes no difference whether you use "jms" or "activemq" as component
name so long you are using the same component (ActiveMqComponent) in both
cases.
The ActiveMqComponent is based on the JmsComponent and "optimized" for
using ActiveMq. Both components support the same set of options.

Using "exchangePattern='InOut'" is not necesary, because you use
"template.requestBody()" which use the InOut MEP.

Best,
Christian

On Mon, Dec 10, 2012 at 11:50 PM, brking <br...@gmail.com> wrote:

> " in the queue name, not

Re: JMS Request Reply not working with temporary queues in 2.8 ?

Posted by brking <br...@gmail.com>.
Thank you for the example. In my case "doesn't work" means requestBody times
out, as I mentioned in my post:

" If I dont set a replyTo queue, requestBody() times out and I never get a 
response" 

I think I may be using the wrong approach. I'm basically trying to follow
the guidance on the Camel JMS documentaiton page. I am new to Camel so bear
with me. Differences between my code and yours:

- I use "jms" in the queue name, not activemq
- I use  exchangePattern=InOut, which I thought was required to do request
reply

Is there a difference using activemq vs jms inn general ? Do the options
here no longer apply ?

http://camel.apache.org/jms.html



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-Request-Reply-not-working-with-temporary-queues-in-2-8-tp5723771p5723866.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JMS Request Reply not working with temporary queues in 2.8 ?

Posted by Christian Müller <ch...@gmail.com>.
What do you mean with "DOESNT WORK"?
You can check out our unit tests at [1] to see how it works.Search for
"RequestReply"...

I also set up a simple unit test with Camel 2.8.0 and ActiveMQ 5.5.1 and it
works:

public class CamelActiveMQInOutPerformanceTest extends CamelTestSupport {

    private int counter = 100;
    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 {
        getMockEndpoint("mock:end").setExpectedMessageCount(counter);

        context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                from("activemq:queue:test")
                    .setBody(constant("Camel"))
                    .to("mock:end");
            }
        });

        for (int i = 0; i < counter; i++) {
            Object response = template.requestBody("activemq:queue:test",
"What's the best integration framework?");
            assertEquals("Camel", response);
        }

        assertMockEndpointsSatisfied();
    }

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


[1]
https://svn.apache.org/repos/asf/camel/tags/camel-2.8.0/components/camel-jms/src/test/java/org/apache/camel/component/jms/

Best,
Christian

On Fri, Dec 7, 2012 at 5:13 PM, brking <br...@gmail.com> wrote:

> I've been trying to get request reply working in 2.8 over JMS. I am
> confused
> as to the following behavior:
>
> - If I dont set a replyTo queue, requestBody() times out and I never get a
> response
>
> - If I set a replyTo queue, I get messages once per second. (I thought this
> was fixed in 2.8 ?), I can improve that by setting receiveTimeout=xxx.
>
> - If I set a replyTo queue and mark it as exclusive I get decent
> performance, but was hoping for better on temporary queues.
>
> I'd like to get temporary queues working. Is there any other requirement
> other than setting exchangePattern=InOut on the Uri ? My code is very
> simple:
>
> // DOESNT WORK String uri = String.format("%s?exchangePattern=InOut",
> requestQueue);
>
> String uri =
> String.format("%s?exchangePattern=InOut&replyTo=%s&replyToType=Exclusive",
> requestQueue, replyQueue);
>
> String result = (String)template.requestBody(uri, data);
>
> I'm using ActievMQ 5.5.1 on Windows 7 64 bit.
>
> Thank you
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JMS-Request-Reply-not-working-with-temporary-queues-in-2-8-tp5723771.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--