| Author | 
		  Message
		 | 
		
		  | gaurang3000 | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 11:14 am    Post subject: Message not getting Published | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 21 Jan 2007 Posts: 6
  
  | 
		  
		    
			  
				Hello,
 
I am using Pure Java Code to publish the MQ messages with MQ RFH header (using MQRFH Version 1). There is one publisher queue and 2 subscriber queues.It gives me error for "MQRC_MSG_FLAGS_ERROR" . Can anybody please tell if i need to set some other flag. Need help for Code below :
 
.....
 
int rfhStrucLength = MQC.MQRFH_STRUC_LENGTH_FIXED_1;
 
sendMessage.format = MQC.MQFMT_RF_HEADER_1;   // Msg Format
 
sendMessage.write(MQRFH_STRUC_ID);   // StrucId
 
sendMessage.writeInt4(MQC.MQRFH_VERSION_1);   // Version
 
int temp = rfhStrucLength +"MQPSCommand Publish MQPSTopic VendorDM MQPSStreamName VendorDM.PUB MQPSQMgrName QM.CIDC.01".length();
 
sendMessage.writeInt4(temp);         // StrucLength  - MQRFH_STRUC_LENGTH_FIXED + NameValuedatalen
 
sendMessage.writeInt4(MQC.MQENC_NATIVE);      // Encoding
 
sendMessage.writeInt4(MQC.MQCCSI_INHERIT);   // CodedCharSetId
 
sendMessage.writeInt4(MQC.MQRFH_NO_FLAGS); // Flags
 
sendMessage.writeString("MQPSCommand Publish MQPSTopic VendorDM MQPSStreamName VendorDM.PUB MQPSQMgrName QM.CIDC.01 ");
 
 
putMsgOption = getPutMessageOptions();
 
sendMessage.writeString(message);
 
sendQueue.put(sendMessage,putMsgOption);
 
mqManager.commit();
 
colseQueueConnection(mqManager); 
 
 
Can any one please suggest some way out.
 
GA-MQ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 1:37 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				If you are doing pub/sub you are better off doing JMS than doing base java.
 
 
Both are "pure" java but JMS will be easier to handle especially for the pesky and required RFH header...
 
 
Enjoy    _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gaurang3000 | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 3:15 pm    Post subject: Need a Java Way plz.. | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 21 Jan 2007 Posts: 6
  
  | 
		  
		    
			  
				First of all thanks for your reply...
 
But i am really interested in finding a way out for the current code...
 
I have travelled far so ....it will be difficult to go for JMS now.... can you please suggest me some way out through Java....
 
Also if you have some running code for it or you can trace some mistakes in above ...i will be thanfull....
 
GA-MQ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 3:35 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Does it give you the error from the PUT or in the broker response? _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gaurang3000 | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 5:20 pm    Post subject: Publish | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 21 Jan 2007 Posts: 6
  
  | 
		  
		    
			  
				The error i get with this code is 
 
Reason code 3023 - MQRC_MSG_FLAGS_ERROR
 
and the message goes to Dead letter Queue.
 
Well the flag i am setting is Header flags - MQRFH_NONE i.e. 0 and this is not the header problem. I am doing a message.put(..)
 
The error persists even if i remove the RFH header.
 
What message flags i need to set ...any idea..
 
the sequence is  :
 
============================================
 
String strCommands="MQPSCommand Publish MQPSTopic VendorDM MQPSStreamName VendorDM.PUB MQPSQMgrName QM.CIDC.01";
 
sendMessage.format = MQFMT_RF_HEADER;
 
long lRFH_Len= MQRFH_STRUC_LENGTH_FIXED +strCommands.length();
 
sendMessage.write(MQRFH_STRUC_ID);   // StrucId
 
sendMessage.writeLong(MQRFH_VERSION_1);   // Version
 
sendMessage.writeLong(lRFH_Len);      
 
sendMessage.writeLong(MQC.MQENC_NATIVE);      // Encoding
 
sendMessage.writeLong(MQC.MQCCSI_INHERIT);//CodedCharacterSetId
 
sendMessage.write(MQFMT_STRING_ARRAY);     // Format
 
sendMessage.writeLong(MQRFH_NONE);   // Flags
 
sendMessage.writeString(strCommands);
 
putMsgOption = getPutMessageOptions();
 
sendMessage.format = MQC.MQFMT_STRING;
 
sendQueue.put(sendMessage,putMsgOption);
 
=============================================
 
GA-MQ | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jefflowrey | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 7:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Poobah
 
 Joined: 16 Oct 2002 Posts: 19981
  
  | 
		  
		    
			  
				Do you get that error after the PUT, or when the broker returns a RESPONSE to your PUT?
 
 
The answer to this question tells you quite a lot about what's wrong with the message -whether the issue is with the MQMD or with the MQRFH2, for example. _________________ I am *not* the model of the modern major general. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Apr 03, 2007 8:12 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| sendMessage.writeLong(MQRFH_NONE); // Flags  | 
   
 
 
Have you tried
   
	| Code: | 
   
  
	| sendMessage.writeLong(MQRFH_FLAGS_NONE); // Flags  | 
   
 
or MQFLAGS_NONE or something like that. The documentation should hold the right possible values...
 
 
You could as well just try to set the value to 0.
 
 
Enjoy    _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |