camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <>
Subject Re: Blueprint request/reply pattern
Date Tue, 28 Jun 2016 15:57:06 GMT
The only thing that looks a little off to me in the XML is the log statement.  I’m not sure
why you’d get the original message - I’d expect it to be null/empty.  Maybe it is getting
set somewhere else in your route?

Here’s a simple example that works for me
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=""

    <bean id="test-broker" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="vm://embedded-broker?create=false"/>

    <camel:camelContext id="blueprint-request-response-context" xmlns="">
        <route id="jms-request-response">
            <from uri="direct://trigger" />
            <to uri="test-broker://queue:testQueue?useMessageIDAsCorrelationID=true" pattern="InOut"/>
            <log message="Response: ${body}" />
            <to uri="mock://target"/>

And here’s a unit test for it so you can see it run
package com.pronoia.camel;

import java.util.Dictionary;
import java.util.Map;

import org.apache.activemq.camel.component.ActiveMQComponent;
import org.apache.activemq.junit.EmbeddedActiveMQBroker;
import org.apache.camel.EndpointInject;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsConstants;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
import org.apache.camel.util.KeyValueHolder;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

public class BlueprintRequestResponseTest extends CamelBlueprintTestSupport {
    public EmbeddedActiveMQBroker broker = new EmbeddedActiveMQBroker();

    @EndpointInject( uri = "mock://target")
    MockEndpoint target;

    protected String getBlueprintDescriptor() {
        return "/OSGI-INF/blueprint/blueprint-request-response.xml";

    protected RoutesBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from( "test-broker://queue:testQueue")
                        .setBody().constant( "Response Message")
                        .to( "test-broker://queue://bar?exchangePattern=InOnly")


    public void testRoute() throws Exception {
        target.expectedBodiesReceived("Response Message");

        template.sendBody("direct://trigger", "Trigger Message");



> On Jun 28, 2016, at 2:43 AM, Thomas Hehl <> wrote:
> Please see my question regarding Active MQ request/reply here:
> Thanks!

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