| Author | Message | 
		
		  | vibhu | 
			  
				|  Posted: Wed Mar 17, 2004 7:22 pm    Post subject: Native to JMS object |   |  | 
		
		  | Newbie
 
 
 Joined: 17 Mar 2004Posts: 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 |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Thu Mar 18, 2004 6:26 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 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 |  | 
		
		  |  | 
		
		  | bower5932 | 
			  
				|  Posted: Thu Mar 18, 2004 8:15 am    Post subject: |   |  | 
		
		  |  Jedi Knight
 
 
 Joined: 27 Aug 2001Posts: 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 |  | 
		
		  |  | 
		
		  | vibhu | 
			  
				|  Posted: Thu Mar 18, 2004 1:24 pm    Post subject: |   |  | 
		
		  | Newbie
 
 
 Joined: 17 Mar 2004Posts: 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 |  | 
		
		  |  | 
		
		  | EddieA | 
			  
				|  Posted: Thu Mar 18, 2004 2:55 pm    Post subject: |   |  | 
		
		  |  Jedi
 
 
 Joined: 28 Jun 2001Posts: 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 |  | 
		
		  |  | 
		
		  | vibhu | 
			  
				|  Posted: Mon Mar 22, 2004 8:20 pm    Post subject: Native to JMS object |   |  | 
		
		  | Newbie
 
 
 Joined: 17 Mar 2004Posts: 4
 
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |