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 » sample java code to post to MQ in CICS format

Post new topic  Reply to topic
 sample java code to post to MQ in CICS format « View previous topic :: View next topic » 
Author Message
santosh_pastay
PostPosted: Fri Dec 18, 2009 1:24 am    Post subject: sample java code to post to MQ in CICS format Reply with quote

Newbie

Joined: 18 Dec 2009
Posts: 1

Hi there,

Is there any working sample of how to post a MQCICS message to MQ queue using java and spring?
I have set the following properties
public BytesMessage createMessage(Session session) {
BytesMessage byteMsg = null;
BigInteger bi = new BigInteger(stringMessage, 16);
byte[] theByteArray = bi.toByteArray();
try {
byteMsg = session.createBytesMessage();
byteMsg.writeBytes(theByteArray);
byteMsg.setIntProperty("JMS_IBM_MsgType", 1);
byteMsg.setStringProperty("JMS_IBM_Format",
MQC.MQFMT_CICS);
byteMsg.setIntProperty("JMS_IBM_Encoding", 785);
byteMsg.setStringProperty("JMS_IBM_Character_Set",
"37");
byteMsg.setIntProperty("JMS_IBM_PutApplType", 11);
byteMsg.setJMSPriority(0);
// byteMsg.setJMSMessageID(byteMsg.getJMSMessageID());
// byteMsg.setJMSTimestamp(byteMsg.getJMSTimestamp());
byteMsg.setJMSReplyTo(respDestination);
byteMsg.setJMSCorrelationIDAsBytes(MQC.MQCI_NEW_SESSION);

but the message is going in MQRFH2 format.
Please help.
-Santosh
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 18, 2009 5:52 am    Post subject: Re: sample java code to post to MQ in CICS format Reply with quote

Grand High Poobah

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

santosh_pastay wrote:
but the message is going in MQRFH2 format.


The RFH2 header (it's not a format, despite the name of the field) is a function of using JMS; it's where WMQ stores the JMS header attributes. If you don't want it, suppress it within JMS.

There have been a number of discussions in here regarding this; I'd imagine it's the same with Java inside CICS but have no direct experience of this.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 18, 2009 2:55 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Set the targetClient Property of the Destination to 1 in Spring.
I would strongly suggest that you set that property to "MQ" in your Destination JNDI.

Have fun :innocent.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » sample java code to post to MQ in CICS format
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.