ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JCN code to put message directly on output Queue

Post new topic  Reply to topic
 JCN code to put message directly on output Queue « View previous topic :: View next topic » 
Author Message
Halloween
PostPosted: Fri Nov 13, 2015 11:42 am    Post subject: JCN code to put message directly on output Queue Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Fri Nov 13, 2015 11:46 am    Post subject: Re: JCN code to put message directly on output Queue Reply with quote

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
View user's profile Send private message
timber
PostPosted: Sat Nov 14, 2015 8:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JCN code to put message directly on output Queue
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.