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 » IBM MQ Java / JMS » Native to JMS object

Post new topic  Reply to topic
 Native to JMS object « View previous topic :: View next topic » 
Author Message
vibhu
PostPosted: Wed Mar 17, 2004 7:22 pm    Post subject: Native to JMS object Reply with quote

Newbie

Joined: 17 Mar 2004
Posts: 4

I have a native application that puts an object in a queue.
The application reading the message is using JMS.
I tried to set the MQMD format as MQFMT_STRING and MQFMT_NONE.
The JMS application either gets a Bytemessage or a Textmessage.

I am not able to set MQRFH2 header in the native application.

Is there a way for the JMS application to get object message
without converting from ByteMessage to object?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 18, 2004 6:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

This "native" application you're talking about - what language is it written in?

What kind of "object" are you putting on the queue - a Java object, a C++ object, a .NET object, or just a structured data container?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Thu Mar 18, 2004 8:15 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If your "native application" is going to send JMS formatted data to a JMS program, then it is going to have to build an RFH2 header that the JMS will understand. Objects are special, and you can't just send them over and hope that they get understood. My advice would be to write a JMS version of your native application so that you can browse the message and figure out what you should be writing. You could also consider writing a text message that is your object flattened to XML. Your JMS could then read this and reassemble the object.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
vibhu
PostPosted: Thu Mar 18, 2004 1:24 pm    Post subject: Reply with quote

Newbie

Joined: 17 Mar 2004
Posts: 4

The native application is written in Java.
I tried the following but still I get Bytemessages.


mqPutMessage.format = MQC.MQFMT_RF_HEADER_2;

String mcd = "<mcd><Msd>jms_object</Msd></mcd>";

String jms = "<jms><Dst>queue:///MY.QUEUE</Dst></jms>";


int mcd_len = ((mcd.length() - 1) / 4) * 4 + 4;
int jms_len = ((jms.length() - 1) / 4) * 4 + 4;

mqPutMessage.writeString("RFH ");
mqPutMessage.writeInt4(2);
mqPutMessage.writeInt(36+mcd_len+jms_len+12);
mqPutMessage.writeInt4(0x00000222);
mqPutMessage.writeInt4(1208);
mqPutMessage.writeString(MQC.MQFMT_NONE);
mqPutMessage.writeInt4(0);
mqPutMessage.writeInt4(1208);
mqPutMessage.writeInt4(mcd_len);
mqPutMessage.writeString(" "+mcd);
mqPutMessage.writeInt4(jms_len);
mqPutMessage.writeString(" "+jms);
mqPutMessage.writeObject(obj);
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Mar 18, 2004 2:55 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
mqPutMessage.writeInt(36+mcd_len+jms_len+12);

Why +12. There's only the 2 Name/Value length fields, which is 8 bytes.

Quote:
mqPutMessage.writeString(" "+mcd);

Why the leading space.

Quote:
mqPutMessage.writeInt4(jms_len);

Unless the length of the preceeding string is an exact multiple of 4, then this will be in the wrong place. And the same for the writeObject.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
vibhu
PostPosted: Mon Mar 22, 2004 8:20 pm    Post subject: Native to JMS object Reply with quote

Newbie

Joined: 17 Mar 2004
Posts: 4

It worked! Thanks a lot.
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 » IBM MQ Java / JMS » Native to JMS object
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.