On Tue, Nov 6, 2012 at 5:00 PM, bung_ho <[email protected]> wrote: > Thanks Christian. I will give this test a try. > > In the meantime I've had to revert to using the MQ API directly. There are > too many MQ specific things we need to do that I don't know how to do in > camel jms. For example, when first accessing the queue, we are required to > set certain options, e.g., > > int openOptions = MQConstants.MQOO_OUTPUT | > MQConstants.MQOO_SET_IDENTITY_CONTEXT; > MQQueue queue = qMgr.accessQueue(queueName, openOptions); > > Anyone have any idea how we'd do this in camel jms? >
You can maybe use a custom destinationResolver to lookup / resolve the JMS queue. And for that then use the MQ API to set those options, you do above. Then the Camel JMS component will use your custom destination resolver to obtain the queue/topic. > > Christian Mueller wrote >> We have a unit test [1] which make sure it works (at least with ActiveMQ). >> May be it's a limitation of WebSphereMQ? Unfortunately I cannot test it, >> but may be you can run this test against WebSphereMQ? >> >> [1] >> https://svn.apache.org/repos/asf/camel/tags/camel-2.10.2/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleHeaderTest.java >> >> Best, >> Christian >> >> On Mon, Nov 5, 2012 at 2:18 PM, bung_ho < > >> bung_ho@ > >> > wrote: >> >>> Hi, are you saying if I use >> <setHeader> >> before the >> <to >>> >> uri="testjms:queue:testqueue"/> in the route, then those camel headers >> will >>> automatically be added as headers on the eventual JMS message? >>> >>> I had tried earlier to use an intermediate bean and in its code I simply >>> did >>> exchange.getIn().setHeader(...) but nothing ever made it to the final jms >>> message. >>> >>> Thanks >>> >>> >>> Claus Ibsen-2 wrote >>> > Hi >>> > >>> > If you want to set this from XML then you can possible do >>> > >> <from ...> >>> > >> <setHeader headerName="JMS_IBM_MQMD_UserIdentifier"> >>> > >> <simple >>> >> > resultType="String"> >>> > JoeBlogs >>> > >> </simple> >>> > >> </setHeader> >>> > >> <setHeader headerName="XXX"> >>> > >> <simple resultType="Integer"> >>> > 5 >>> > >> </simple> >>> > >> </setHeader> >>> > eg using the simple language to set a value, and define the type using >>> > resultType. >>> > >>> > For the WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT you would need to >>> > get the actual String value they represent. >>> > And us the string value in the XML. >>> > >>> > >>> > On Sun, Nov 4, 2012 at 7:00 PM, bung_ho < >>> >>> > bung_ho@ >>> >>> > > wrote: >>> >> Hi, we are trying to set specific MQ headers on a message that is >>> >> required by >>> >> the receiver. In particular we are trying to do what is specified in >>> this >>> >> MQ >>> >> documentation: >>> >> >>> http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fjm41030_.htm >>> >> >>> >> In particular it calls for this code, but we don't know how/where we >>> >> could >>> >> implement this: >>> >> >>> >> /* ---------------------------------------- */ >>> >> // Enable MQMD write >>> >> dest.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true); >>> >> >>> >> // Optionally, set a message context if applicable for this MD field >>> >> dest.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT, >>> >> WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT); >>> >> >>> >> // On the message, set property to provide custom UserId >>> >> msg.setStringProperty("JMS_IBM_MQMD_UserIdentifier", "JoeBloggs"); >>> >> >>> >> // Send >>> >> >>> >> /* ---------------------------------------- */ >>> >> >>> >> >>> >> >>> >> We are using camel 2.10 with spring XML. The way we are sending >>> messages >>> >> is >>> >> simple, the route is just like (for example): >>> >> >>> >> >>> >> >>> > >> <route> >>> >> >>> > >> <from uri="(reads a test message from a file and places the contents >>> >> >> >>> > in the Exchange body)"/> >>> >> >>> > >> <to uri="testjms:queue:testqueue"/> >>> >> >>> > >> </route> >>> >> >>> >> ... >>> >> >>> >> >>> >> testjms is configured as a bean like so: >>> >> >>> >> >>> > >> <bean id="testjmsConfig" >>> >> >> >>> > class="org.apache.camel.component.jms.JmsConfiguration"> >>> >> >>> > >> <property name="connectionFactory" ref="atomikosTestConnectionFactory" /> >>> >> >>> > >> <property name="transactionManager" ref="JtaTransactionManager"/> >>> >> >>> > >> </bean> >>> >> >>> > >> <bean id="testjms" class="org.apache.camel.component.jms.JmsComponent"> >>> >> >>> > >> <property name="configuration" ref="testjmsConfig" /> >>> >> >>> > >> </bean> >>> >> >>> >> >>> >> This set up works for the basic putting of messages on the queue. So I >>> >> was >>> >> hoping we could just set headers on the camel Exchange object and that >>> >> would >>> >> automatically be translated to the MQ headers. But they didn't get >>> passed >>> >> on >>> >> that way. So how do we set those headers? >>> >> >>> >> Hope I have provided enough info. Thanks >>> >> >>> >> >>> >> >>> >> >>> >> -- >>> >> View this message in context: >>> >> >>> http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-headers-tp5722102.html >>> >> Sent from the Camel - Users mailing list archive at Nabble.com. >>> > >>> > >>> > >>> > -- >>> > Claus Ibsen >>> > ----------------- >>> > Red Hat, Inc. >>> > FuseSource is now part of Red Hat >>> > Email: >>> >>> > cibsen@ >>> >>> > Web: http://fusesource.com >>> > Twitter: davsclaus >>> > Blog: http://davsclaus.com >>> > Author of Camel in Action: http://www.manning.com/ibsen >>> >>> >>> >>> >>> >>> -- >>> View this message in context: >>> http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-headers-tp5722102p5722145.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >> >> >> >> -- > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/camel-jms-setting-specific-MQ-headers-tp5722102p5722236.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
