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 » JavaCompute Creating a new MQ message with BLOB data

Post new topic  Reply to topic
 JavaCompute Creating a new MQ message with BLOB data « View previous topic :: View next topic » 
Author Message
kayhansefat
PostPosted: Wed Nov 08, 2006 6:35 am    Post subject: JavaCompute Creating a new MQ message with BLOB data Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Hi,

I am new to MQ and Message Broker V6 and would like some advice on creating a new MQ valid message with an MQMD header but with a BLOB element that can hold some string data within the message.

So far I can create a message and send it to a queue using:

Code:
MbMessage inMessage = contact admin.getMessage()
MbMessage outMessage = new MbMessage()
MbMessageAssembly outAssembly = new MbMessageAssembly (contact admin, outMessage);

try
{
    copyMessageHeaders(inMessage,outMessage);
    MbElement root = outMessage.getRootElement();
    MbElement mqmd = root.createElementAsFirstChild("MQHMD");
    mqmd.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "Format", "BLOB");
}


Can you advise me if this is the correct way to go about it? And from here how can I add the BLOB header with some string text?

Thanks for your help, much appreciated.

Kayhan
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 08, 2006 6:41 am    Post subject: Re: JavaCompute Creating a new MQ message with BLOB data Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kayhansefat wrote:
a BLOB element that can hold some string data within the message.


If it's string data, why a BLOB?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kayhansefat
PostPosted: Wed Nov 08, 2006 6:45 am    Post subject: Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Ah, well due to my lack of knowledge I thought that the BLOB parser would be the one to use, is this not correct?

The data I am looking to send in the message will basically be a string that contains fields that are delimited with pipes "|".

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 08, 2006 6:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Well not wrong per se, but a bit unusual. It implies that you want the broker to be blind to the content, precluding things like message mapping / transformation without doing it yourself. Normally delimited strings are handled with message sets. Thus allowing you to populate the message body by manipulation of the message set.

But hey. It's your solution. Though if your lack of knowledge is such that you don't know about message sets, I would urge you to hit the books before you go too much further. MB is a complex piece of software and will bite if improperly handled. I offer as evidence the number of questions in this section!

You can continue to add BLOB elements as children of the MQMD, or more likely a single BLOB element containing the string data you're interested in.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kayhansefat
PostPosted: Wed Nov 08, 2006 7:16 am    Post subject: Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Well within my JavaCompute node I read a simple text file where each of the fields are separated on a different line. As I first incorrectly thought that a BLOB message is the way to handle the data I read through each of the lines and created the delimited string.

If its not too much trouble could you advise me how to create the single BLOB element with the string? This will help me for now but I do agree that I need to look up message sets and how to use them with this, any ideas/tutorials that you know of?

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 08, 2006 7:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

As I said before, it's perfectly valid to handle your data as a BLOB, just unusual as it obviates many of the benefits of MB. The comment about your knowledge level was intended as a more generalised point, and I apologise for any offense unintentionally caused.

Because the broker is blind to BLOB elements they can simply be attached to the message tree.

As to ideas/tutorials/etc, you'll find a wealth of information at:

http://www-306.ibm.com/software/integration/wbimessagebroker/library/
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 08, 2006 7:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'm going to give you a lot of information.

Most of it probably won't make sense.

You need to get training on WMB.

Here's your answer.

BLOB is a physical format. Within a Java Compute node, you are working with a Logical Message tree. Elements in the Logical Message tree exist without physical information, except in the following way. They belong to a tree that has a Parser assigned to it, and they have Types that indicate what, umm, type in that Parser they are.

A properly formatted BLOB parser tree has only a single element, with the fixed name of "BLOB", and that element has a type that is the only type in the BLOB parser and has a value that is a bitstream.

Why are you trying to read a file from a JCN?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kayhansefat
PostPosted: Wed Nov 08, 2006 8:58 am    Post subject: Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Vitor, thanks for your reply and don't worry I totally took your comment as jest, not as an offense. I have had a good look through the MB library but I can't find anything that shows how to set the BLOB's bitstream element, any ideas?

jefflowrey, Thanks for your post. I have a large number of files that are ftp'd onto the server that the MB is installed on and these files need to be sent to a remote MQ Queue.

Now my initial thinking was to have a TimeoutNotification node that triggers every say 2 seconds. Following this would be the JavaComputeNode that reads the first file in the directory, gets the data (stored as String) and would then amend this onto a new MQ message and output it to the queue. Does this sound reasonable or is there a 'MB' way of doing this?
Back to top
View user's profile Send private message
kayhansefat
PostPosted: Fri Nov 10, 2006 1:33 am    Post subject: Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

I have managed to create the MQMD header under the root element in the tree but does anyone know how to create the last child of root as a BLOB with BLOB text?
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 » JavaCompute Creating a new MQ message with BLOB data
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.