Sending MQMD headers from Apache camel.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sending MQMD headers from Apache camel.

ravi21588
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending MQMD headers from Apache camel.

Tomohisa Igarashi
Ravi, I said "DO NOT post SwitchYard or JBoss question here" again and again. Please stop spamming.

On 03/14/2017 12:50 AM, ravi21588 wrote:

> Hi All,
> iam using Jboss Fuse service works 6.0 with Switchyard 1.1 and camel 2.10.
> iam trying to set MQMD headers for the JMS message and send it to IBM MQ.
> By seeing camel documentation and various blogs i came to know that this can
> be achieved by using Spring destinationResolver.
> I would like to set the advanced options destinationResolver as a param and
> set the MQMD headers.
> Can you please tell me how can i achieve it.
>
> Switchyardxml:
> <?xml version="1.0" encoding="UTF-8"?>
> <sy:switchyard xmlns:camel="urn:switchyard-component-camel:config:1.1"
> xmlns:jms="urn:switchyard-component-camel-jms:config:1.1"
> xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
> xmlns:sy="urn:switchyard-config:switchyard:1.1" name="ScaToJms"
> targetNamespace="urn:com.company.esb.destinationsystem.in.read.sync:ScaToJms:1.0">
>   <sca:composite name="ScaToJms"
> targetNamespace="urn:com.company.esb.destinationsystem.in.read.sync:ScaToJms:1.0">
>     <sca:component name="destinationsystemInReadSimulator">
>       <camel:implementation.camel>
>         <camel:xml path="route/camelroute.xml"/>
>       </camel:implementation.camel>
>       <sca:service name="destinationsystemInReadJmsService">
>         <sca:interface.java
> interface="com.company.esb.common.services.esbMessageInOutService"/>
>       </sca:service>
>       <sca:reference name="destinationsystemService">
>         <sca:interface.java
> interface="com.company.esb.common.services.RunnableInOutService"/>
>       </sca:reference>
>       <sca:reference name="AuditLodestinationsystemerService">
>         <sca:interface.java
> interface="com.company.esb.common.services.AuditLodestinationsystemerService"/>
>       </sca:reference>
>       <sca:reference name="ExceptionHandlerService">
>         <sca:interface.java
> interface="com.company.esb.common.services.ExceptionHandlerService"/>
>       </sca:reference>
>     </sca:component>
>     <sca:service name="destinationsystemInReadJmsService"
> promote="destinationsystemInReadSimulator/destinationsystemInReadJmsService">
>       <sca:interface.java
> interface="com.company.esb.common.services.esbMessageInOutService"/>
>       <sca:binding.sca name="Sca1"/>
>     </sca:service>
>     <sca:reference name="destinationsystemService" multiplicity="0..1"
> promote="destinationsystemInReadSimulator/destinationsystemService">
>       <sca:interface.java
> interface="com.company.esb.common.services.RunnableInOutService"/>
>       <jms:binding.jms name="jms">
>         <jms:contextMapper includes="JMS.*"/>
>         <jms:additionalUriParameters>
>           <jms:parameter name="disableTimeToLive" value="true"/>
>           <jms:parameter name="useMessageIDAsCorrelationID" value="true"/>
>           <jms:parameter name="jmsMessageType" value="Text"/>
>           <jms:parameter name="destinationResolver"
> value="com.company.esb.destinationsystem.in.read.customDestinationResolver"/>
>         </jms:additionalUriParameters>
>         <jms:queue>${destinationsystem.Claws.Read.In}</jms:queue>
>
> <jms:connectionFactory>${destinationsystem.In.Read.ConnectionFactoryname}</jms:connectionFactory>
>         <jms:replyTo>${destinationsystem.Claws.Read.Out}</jms:replyTo>
>
> <jms:requestTimeout>${destinationsystem.In.Read.destinationsystemResponseTimeout}</jms:requestTimeout>
>       </jms:binding.jms>
>     </sca:reference>
>     <sca:reference name="AuditLodestinationsystemerService"
> multiplicity="0..1"
> promote="destinationsystemInReadSimulator/AuditLodestinationsystemerService">
>       <sca:interface.java
> interface="com.company.esb.common.services.AuditLodestinationsystemerService"/>
>       <sca:binding.sca sy:target="AuditLodestinationsystemerService"
> sy:targetNamespace="urn:com.company.esb.components:AuditLodestinationsystemer:1.0"
> name="ScaAudit"/>
>     </sca:reference>
>     <sca:reference name="ExceptionHandlerService" multiplicity="0..1"
> promote="destinationsystemInReadSimulator/ExceptionHandlerService">
>       <sca:interface.java
> interface="com.company.esb.common.services.ExceptionHandlerService"/>
>       <sca:binding.sca sy:target="ExceptionHandlerService"
> sy:targetNamespace="urn:com.company.esb.components:ExceptionHandler:1.0"
> name="ScaExceptionHandler"/>
>     </sca:reference>
>   </sca:composite>
>   <sy:domain>
>     <sy:properties>
>       <sy:property name="org.switchyard.handlers.messageTrace.enabled"
> value="false"/>
>     </sy:properties>
>   </sy:domain>
> </sy:switchyard>
>
> customDestinationResolver.java
>
> package com.company.esb.destinationsystem.in.read;
>
> import javax.jms.JMSException;
> import javax.jms.Queue;
> import javax.jms.QueueSession;
> import javax.jms.Session;
>
> import
> org.springframework.jms.support.destination.DynamicDestinationResolver;
>
> import com.ibm.mq.jms.MQQueue;
>
>
>
>
> public class customDestinationResolver extends DynamicDestinationResolver {
>
> private final boolean excludeRFHeaders;
>
>    public customDestinationResolver(boolean excludeRFHeaders) {
>        this.excludeRFHeaders = excludeRFHeaders;
>    }
>
> //    public Destination resolveDestinationName(Session session, String
> destinationName, boolean pubSubDomain) throws JMSException {
> //        MQDestination destination = (MQDestination)
> super.resolveDestinationName(session, destinationName, pubSubDomain);
> //        destination.setBooleanProperty(WMQ_MQMD_WRITE_ENABLED, true);
> //        destination.setBooleanProperty(WMQ_MQMD_READ_ENABLED, true);
> //        destination.setIntProperty(WMQ_MQMD_MESSAGE_CONTEXT,
> WMQ_MDCTX_SET_ALL_CONTEXT);
> //        if (excludeRFHeaders) {
> //            destination.setTargetClient(1);
> //        }
> //        return destination;
> //    }
> //
>    protected Queue resolveQueue(Session session, String queueName) throws
> JMSException {
>        MQQueue dest = null;
>        if (session instanceof QueueSession) {
>           dest = (MQQueue)((QueueSession) session).createQueue(queueName);
>        }
>        else {
>            dest = (MQQueue)session.createQueue(queueName);
>        }
>        // use IBM MQ API to set properties on the Destination
>        dest.setMQMDWriteEnabled(true);
>        dest.setMQMDMessageContext(1);
>
>        return dest;
>    }
>
> }
>
>
>
> Iam gettting below exception:
>
> Caused by: java.lang.NoClassDefFoundError:
> org/springframework/jms/support/destination/DynamicDestinationResolver
> at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_80]
> at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
> [rt.jar:1.7.0_80]
> at
> org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> at
> org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> ... 20 more
> Caused by: java.lang.ClassNotFoundException:
> org.springframework.jms.support.destination.DynamicDestinationResolver from
> [Module "deployment.GGInRead.jar:main" from Service Module Loader]
> at
> org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> at
> org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> at
> org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> at
> org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> at
> org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
> [jboss-modules.jar:1.3.3.Final-redhat-1]
> ... 24 more
>
>
> Can you please let me know if there is anything wrong in my code,also it
> would be great if you can  share an example.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Sending-MQMD-headers-from-Apache-camel-tp5795370.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sending MQMD headers from Apache camel.

ravi21588
This post has NOT been accepted by the mailing list yet.
Apologies TOM,I will move it to switchyard forum.
Loading...