I want to make such a solution:
Now, I came with a kind of a solution but I'm not sure how to process response from activemq and send back as SOAP response. My camel blueprints below. Endpoint blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:soap="http://cxf.apache.org/blueprint/bindings/soap"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://cxf.apache.org/blueprint/bindings/soap http://cxf.apache.org/schemas/configuration/blueprint/soap.xsd">
<bean id="cardServiceEndpoint" class="com.endpoint.card.CardEndpoint">
<argument>
<reference interface="com.card.CardService" />
</argument>
</bean>
<cxf:cxfEndpoint
id="cardEndpoint"
address="https://host:port/soa/card"
serviceClass="com.card.CardService">
<cxf:properties>
<entry key="schema-validation-enabled" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
<bean id="jaxB" class="org.apache.camel.model.dataformat.JaxbDataFormat">
<property name="prettyPrint" value="true" />
<property name="contextPath" value="com.type.card" />
</bean>
<camelContext id="endpoint-card-cxf" xmlns="http://camel.apache.org/schema/blueprint">
<route id="endpoint-soap-in">
<from uri="cxf:bean:cardEndpoint"/>
<transform>
<simple>${body[0]}</simple>
</transform>
<marshal ref="jaxB"/>
<setHeader headerName="JMSType">
<simple>${headers.operationName}</simple>
</setHeader>
<to uri="amq:q.in"/>
</route>
<route id="endpoint-soap-out">
<from uri="amq:q.out" />
<unmarshal ref="jaxB" />
<!-- STUCK HERE :( -->
</route>
</camelContext>
</blueprint>
Service processor blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="cardService" class="com.card.impl.DefaultCardService">
<argument>
<reference interface="com.base.StashService"/>
</argument>
</bean>
<service interface="com.card.CardService" ref="cardService" />
<bean id="amqCardServiceEndpoint" class="com.card.endpoint.AmqCardEndpoint">
<argument ref="cardService" />
</bean>
<bean id="jaxB" class="org.apache.camel.model.dataformat.JaxbDataFormat">
<property name="prettyPrint" value="true" />
<property name="contextPath" value="com.type.base:com.type.card" />
</bean>
<camelContext id="service-card-cx" xmlns="http://camel.apache.org/schema/blueprint">
<route id="card-rq-broker">
<from uri="amq:queue:q.in?asyncConsumer=true" />
<unmarshal ref="jaxB" />
<doTry>
<bean ref="amqCardServiceEndpoint" method="invoke" />
<doCatch>
<exception>com.type.base.BaseException</exception>
<setBody>
<simple>${exception.getFaultInfo()}</simple>
</setBody>
</doCatch>
</doTry>
<marshal ref="jaxB" />
<to uri="amq:q.out" />
</route>
</camelContext>
</blueprint>
Any help or advice?
Use jmsReplyTo
to specify the name of the reply queue (if you want a fixed queue name) that Camel should use for listening for the response. See more about request/reply on the Camel JMS documentation.
<to uri="amq:q.in?jmsReplyTo=q.out"/>
// continue here when reply is back