Author |
Message
|
namakkal |
Posted: Tue Feb 10, 2009 5:45 am Post subject: JavaCompute Node Propagate |
|
|
Novice
Joined: 06 Feb 2009 Posts: 19
|
Hi
how to propagate string instead of Assembly message in javacompute node propagate statement.
now i propagating like this
out.propagate("stringvalue") but its rising error message onlyAssembly message allowed .can anyone please tell me how to send string via propagate statement |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 10, 2009 5:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
And what is any node further down supposed to do with a string instead of an assembly?
Instead of asking how to do something that would be a really bad idea even if it was possible, maybe you can describe what you are *trying* to do.
Perhaps this sample code from the InfoCenter is what you want
Code: |
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes()); |
|
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 10, 2009 5:53 am Post subject: Re: JavaCompute Node Propagate |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
namakkal wrote: |
how to propagate string instead of Assembly message in javacompute node propagate statement.
|
Ok, Java, not my strong suit so may be off track here but a) why would you want to propagate a string instead of a message b) how could it possibly work when the downstream node will be expecting a message tree c) why do you think it ought to work and d) why would you want to?
(A question so important I ask it twice!) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 10, 2009 5:57 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Perhaps this sample code from the InfoCenter is what you want
Code: |
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes()); |
|
But clearly the poster knows this, as they know how to propagate assemblies, and has discounted this method as unsuitable.
Still, as they've not shared their requirement we toil in ignorance.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
chids |
Posted: Tue Feb 10, 2009 6:19 am Post subject: Re: JavaCompute Node Propagate |
|
|
 Novice
Joined: 09 Oct 2006 Posts: 22 Location: Stockholm, Sweden
|
namakkal wrote: |
Hi
how to propagate string instead of Assembly message in javacompute node propagate statement.
now i propagating like this
out.propagate("stringvalue") but its rising error message onlyAssembly message allowed .can anyone please tell me how to send string via propagate statement |
You can't. You'll need to put your string somewhere inside an MbMessageAssembly preferably either in the message or in the local or global environment tree structures and propagate the assembly.
But, as the others are saying: what are you trying to achieve?
/mårten. |
|
Back to top |
|
 |
Gaya3 |
Posted: Tue Feb 10, 2009 7:11 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
if you can (infact you can't) then there wont be any difference between common Java program and MB Java Code
as all experts said, its not possible, use assembley in out propagate as that contains the full details of the message desc. _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
namakkal |
Posted: Tue Feb 10, 2009 7:28 pm Post subject: |
|
|
Novice
Joined: 06 Feb 2009 Posts: 19
|
mqjeff wrote: |
And what is any node further down supposed to do with a string instead of an assembly?
Instead of asking how to do something that would be a really bad idea even if it was possible, maybe you can describe what you are *trying* to do.
Perhaps this sample code from the InfoCenter is what you want
Code: |
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes()); |
|
Actually in my scenario, i make a call to TCP socket from my Java Compute node. The TCP server returns me a Pipe Delimited message. Now i want to propagate this Pipe delimited message to a compute node which follows it.
I have tried doing this by getting the Pipe delimited message as String in Java Compute node and propagating it. Please help me in doing this, since i am new to this.
Regards,
Sathish. |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Feb 10, 2009 8:10 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Code: |
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes()); |
The code that mqjeff mentoned will work for your scenario. Assign the pipe delimited message you receive to the string and create the blob domain in output and create the blob element to hold the message in bytes.
If you need to process the pipe delimited message in next compute node, you will have to parse the message against a TDS message set. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
namakkal |
Posted: Tue Feb 10, 2009 9:15 pm Post subject: Propagate BLOB |
|
|
Novice
Joined: 06 Feb 2009 Posts: 19
|
MQEnthu wrote: |
Code: |
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes()); |
The code that mqjeff mentoned will work for your scenario. Assign the pipe delimited message you receive to the string and create the blob domain in output and create the blob element to hold the message in bytes.
If you need to process the pipe delimited message in next compute node, you will have to parse the message against a TDS message set. |
Hi
yes i have created the BLOB domain, now i want to propagate the Blob value to Next node how do we acheive that? ctually i am new for Java cumpute node .
FYI
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes());
now outBodyE12 contains the BLOB message. now want to use that in next node
Regards
Sathish |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Feb 10, 2009 9:58 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
You will have to propagate outassembly... not just the the MbElement...infact you get the propagate statement in the default code of JCN.. I think you have to go through info center to know more about JCN...
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
namakkal |
Posted: Tue Feb 10, 2009 10:31 pm Post subject: |
|
|
Novice
Joined: 06 Feb 2009 Posts: 19
|
Propagating OutAssembly is fine and is available by default in JCN, but my doubt is how do we actually send a BLOB data through the OutAssembly to next node. Can you please explain it wait a sample code snippet.
Also i have doubt regarding reading a BLOB message from previous Compute node through contact admin. Please help me on this.
Regards,
Sathish. |
|
Back to top |
|
 |
MQEnthu |
Posted: Tue Feb 10, 2009 11:04 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Code: |
// create new message
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,outMessage);
// optionally copy message headers
copyMessageHeaders(inMessage, outMessage);
// create blob message
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes());
// propagating message to the 'out' terminal
out.propagate(outAssembly);
|
You have to create the outassembly and that code also come in the default JCN code for create new message.. I think you shoud refer to info center...
Quote: |
Also i have doubt regarding reading a BLOB message from previous Compute node through contact admin. Please help me on this. |
Do you mean, you want to read this message in the next compute node? You will have to parse the message if you want process it. I belive yours is a delimited message. You will have to create MRM message set to parse the message, so that you can process it in next node. _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Feb 11, 2009 1:40 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
MQEnthu wrote: |
Code: |
// create new message
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,outMessage);
// optionally copy message headers
copyMessageHeaders(inMessage, outMessage);
// create blob message
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBodyEl2 = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes());
// propagating message to the 'out' terminal
out.propagate(outAssembly);
|
You have to create the outassembly and that code also come in the default JCN code for create new message.. I think you shoud refer to info center...
Quote: |
Also i have doubt regarding reading a BLOB message from previous Compute node through contact admin. Please help me on this. |
Do you mean, you want to read this message in the next compute node? You will have to parse the message if you want process it. I belive yours is a delimited message. You will have to create MRM message set to parse the message, so that you can process it in next node. |
Hi,
I have been following this thread and even I would like to know about, how to read a MRM message from the contact admin in JCN.
My secnario is,
MQINput--->Compute1---->JavaCompute--->Compute2---->MQOut.
Now, i am generating a PipeDelimited message in Compute1 and want to send it to a socket server using JCN. In JCN how do i read this PipeDelimited message. Similarly once i send this PipeDelimited message to SocketServer, i would be getting a response back and i need to send it as a BLOB to Compute2 node.
How do I do this, It would be fine If you can provide some sample code for dealing with contact admin and OutAssembly.
Regards,
Kashyap. |
|
Back to top |
|
 |
MQEnthu |
Posted: Wed Feb 11, 2009 4:24 am Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
Quote: |
once i send this PipeDelimited message to SocketServer, i would be getting a response back and i need to send it as a BLOB to Compute2 node.
|
Above posts will help you in doing this
Quote: |
In JCN how do i read this PipeDelimited message |
It is well documented in info center with an example (may not be TDS message)...please refer to the topic 'Accessing elements in a message tree from a JavaCompute node' ...
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ac30330_.htm _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Feb 11, 2009 5:51 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
Actually in my case the message is TDS and i dont find any examples related to this in the info center. So can anyone please give some samples on this. |
|
Back to top |
|
 |
|