|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JCN code to put message directly on output Queue |
« View previous topic :: View next topic » |
Author |
Message
|
Halloween |
Posted: Fri Nov 13, 2015 11:42 am Post subject: JCN code to put message directly on output Queue |
|
|
Acolyte
Joined: 11 Mar 2015 Posts: 60
|
Can anyone please help me on putting the message directly on the output queue from java compute node? I am talking about the string message. After logic in JCN, i am storing the result in string variable. I want to put this string value in string variable directly to the output queue or defined queue name.
I would appreciate if any sample code help here |
|
Back to top |
|
 |
Vitor |
Posted: Fri Nov 13, 2015 11:46 am Post subject: Re: JCN code to put message directly on output Queue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Halloween wrote: |
Can anyone please help me on putting the message directly on the output queue from java compute node? I am talking about the string message. After logic in JCN, i am storing the result in string variable. I want to put this string value in string variable directly to the output queue or defined queue name. |
Do not do this. Broker mediates all connectivity between itself and the queue manager. At best you'll break the transactional integrity of the flow, at worst you'll bring the broker down.
Use the MQOutput node to write this value to a queue. Likewise only use the MQInput or MQGet nodes to read from a queue. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
timber |
Posted: Sat Nov 14, 2015 8:46 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Something like this:
1. Convert the string to a byte array, specifying the encoding:
Code: |
byte[] myByteArrray = myStringValue.getBytes(theEncodingExpectedByTheReceiver); |
2. Create a message body in the BLOB domain, create the only allowable child element 'BLOB' and assign the byte array to it:
Code: |
root.createElementAsLastChild(MbBLOB.PARSER_NAME).createElementAsLastChild(MbElement.TYPE_NAME, 'BLOB', myByteArray); |
3. Propagate that message tree to an MQOutput node, where it will be written to the queue. Don't try to implement that part in Java. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|