Bean & Context Settings (Blueprint file):

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
xmlns:camel="http://camel.apache.org/schema/blueprint";
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint-2.10.7.xsd
http://camel.apache.org/schema/blueprint/cxf
http://camel.apache.org/schema/blueprint/cxf/camel-cxf-2.9.0.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
">

<!-- Properties file - place it at $SMX_HOME/etc/org.client.mq.cfg -->
<cm:property-placeholder id="client.properties" persistent-id="org.client.mq"
update-strategy="reload">
<cm:default-properties>
<cm:property name="client.mq.hostname" value="127.0.0.1" />
<cm:property name="client.mq.port" value="1414" />
<cm:property name="client.mq.channel" value="CONN.01" />
<cm:property name="client.mq.queueManager" value="QM" />
<cm:property name="client.mq.requestQueueManager" value="rqm1" />
<cm:property name="client.mq.responseQueueManager" value="rqm2" />
<cm:property name="client.ws.scheme" value="http" />
<cm:property name="client.ws.host" value="localhost" />
<cm:property name="client.ws.port" value="12345" />
<cm:property name="client.ws.path"
value="client_interfaces_service/client_interfaces" />
</cm:default-properties>
</cm:property-placeholder>

<!-- CXF (SOAP Web Service) end point. dataFormat is PAYLOAD so we don't
waste time unmarshalling to beans and then immediately marshalling back
into XML. -->
<camelcxf:cxfEndpoint id="client_mq"
address="{{client.ws.scheme}}://{{client.ws.host}}:{{client.ws.port}}/{{client.ws.path}}"
wsdlURL="META-INF/wsdl/clientInterfaces.wsdl"
serviceName="client:clientService"
xmlns:client="http://ws.client.org.com/";>
<camelcxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
<entry key="portName" value="{http://ws.client.org.com/}clientPort"; />
</camelcxf:properties>
</camelcxf:cxfEndpoint>

<!--
=========
| BEANS |
=========
-->

<bean id="jaxbContextFactory" class="com.org.client.ws.JAXBContextFactory">
<argument ref="clientWebServiceCamelContext" />
</bean>

<bean id="globalRequestHeaderJaxbContext" factory-ref="jaxbContextFactory"
factory-method="newInstance">
<argument value="com.org.client.xsd.request" />
</bean>

<bean id="cxfHeaderProcessor" class="com.org.client.ws.CXFHeaderProcessor">
<argument value="soap_header" />
<argument>
<map>
<entry key="globalRequestHeader" value-ref="globalRequestHeaderJaxbContext"
/>
</map>
</argument>
</bean>

<bean id="imq" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig" />
</bean>

<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="transacted" value="false"/>
<property name="cacheLevelName" value="CACHE_CONNECTION"/>
</bean>

<bean id="jmsConnectionFactory"
class="com.ibm.mq.jms.MQQueueConnectionFactory" >
<property name="hostName" value="${client.mq.hostname}"/>
<property name="port" value="${client.mq.port}"/>
<property name="channel" value="${client.mq.channel}"/>
<property name="queueManager" value="${client.mq.queueManager}"/>
<property name="transportType" value="1"/>
<property name="MQConnectionOptions" value="1" />
<property name="failIfQuiesce" value="1" />
</bean>

<!--
==========
| ROUTES |
==========
-->

<camel:camelContext id="clientWebServiceCamelContext">
<camel:route>
<!-- Receive a Web Service request ... -->
<camel:from uri="cxf:bean:client_mq" />

<!-- ... extract the SOAP headers from the payload ... -->
<camel:to uri="bean:cxfHeaderProcessor" />

<!-- ... set up the various URIs we need before we head out to the first
one, as we lose the soap_header_globalRequestHeader after going to the
first NMR endpoint - not sure why (might only be able to store String
headers) ... -->
<camel:setHeader headerName="requestTransformUri">
<camel:simple>nmr:requestTransform</camel:simple>
</camel:setHeader>

<camel:setHeader headerName="mqUri">
<camel:simple>imq:queue:REQUEST_QUEUE?replyTo=REPLY_QUEUE&amp;replyToType=Shared</camel:simple>
</camel:setHeader>

<camel:setHeader headerName="responseTransformUri">
<camel:simple>nmr:responseTransform</camel:simple>
</camel:setHeader>

<!-- ... send to the system-specific request transform route ... -->
<camel:recipientList>
<camel:simple>${in.header.requestTransformUri}</camel:simple>
</camel:recipientList>

<!-- ... send transformed request to MQ ... -->
<camel:recipientList>
<camel:simple>${in.header.mqUri}</camel:simple>
</camel:recipientList>

<!-- ... send the MQ response to the system-specific response transform
route, which will be sent back as the response to the Web Service request.
-->
<camel:recipientList>
<camel:simple>${in.header.responseTransformUri}</camel:simple>
</camel:recipientList>
</camel:route>
</camel:camelContext>
</blueprint>

Thanks,

- Andrew Thorburn


On Tue, Jan 28, 2014 at 1:21 PM, Andrew Thorburn <[email protected]> wrote:

> Using SMX 4.5.3 and Camel 2.10.7 (the version included with SMX).
>
> I've got my application set up to use the IBM MQ JMS APIs to transfer
> messages to a WebSphere MQ server. That works fine (which surprised
> me, frankly!), but if the destination doesn't exist, I see the
> following in the log:
>
> 19:14:11,034 | WARN  | <REPLY_QUEUE>] |
> entQueueMessageListenerContainer | 104 - org.springframework.jms -
> 3.0.7.RELEASE | Setup of JMS message listener invoker failed for
> destination '<REPLY_QUEUE>' - trying to recover. Cause: MQJMS2008:
> failed to open MQ queue ; nested exception is com.ibm.mq.MQException:
> MQJE001: Completion Code 2, Reason 2085
> 19:14:11,458 | INFO  | <REPLY_QUEUE>] |
> entQueueMessageListenerContainer | 104 - org.springframework.jms -
> 3.0.7.RELEASE | Successfully refreshed JMS Connection
>
> In this case, I'm using a Request/Reply pattern, with the request
> going out on Queue A, and the reply coming in on Queue B. If neither A
> nor B exist, I get the above error in the logs, every 10 seconds or
> so, as it tries to reconnect to the reply queue (which fails, because
> it does not and will never exist). It also spits out an error
> connecting to the request queue, but that's not a surprise, and only
> occurs once.
>
> Does anyone know how I can deal with this? Do I need to set a
> particular property on the JMS Config or something? I see there is a
> receiveTimeout, but since it's not even connecting, I'm not sure
> that's going to be much use.
>
> Thanks,
>
> - Andrew Thorburn
>

Reply via email to