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 » Very very urgeent help required

Post new topic  Reply to topic
 Very very urgeent help required « View previous topic :: View next topic » 
Author Message
shantha
PostPosted: Sun Jun 27, 2004 8:04 am    Post subject: Very very urgeent help required Reply with quote

Apprentice

Joined: 11 Dec 2003
Posts: 41

Hi all,
I am doing a synchrnous communication with the SAP with a wait time of 60 secs

this is code i am using

MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
MQEnvironment.port = tcpPort;
System.out.println("ccsid in response *******=" + iccsid);
MQEnvironment.CCSID = iccsid;
System.out.println("OPENING QUEUE MANAGER CONNECTION....");
qMgr = new MQQueueManager(qManager);

int oo = MQC.MQOO_INPUT_SHARED + MQC.MQOO_INQUIRE;
System.out.println("OPENING....QUEUE");
q = qMgr.accessQueue(matQ,oo,null,null,null);
int depth = q.getCurrentDepth();
MQGetMessageOptions GMO = new MQGetMessageOptions();
GMO.options = MQC.MQGMO_WAIT + MQC.MQGMO_COMPLETE_MSG;
GMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;///Integer.parseInt(sMessageId);//MQC.MQMO_MATCH_MSG_ID;
GMO.waitInterval = intWait;
System.out.println("The intWait Value is = " + intWait);
MQMessage mes = new MQMessage();

// mes.correlationId = sMessageId.getBytes();
String scorrelationId = new String(mes.correlationId);
System.out.println("CorrelationId ==" + scorrelationId);
q.get(mes,GMO);
byte[] strData = new byte[mes.getTotalMessageLength()];
Temp=new String(mes.messageId);
String MesId= Temp.trim();
System.out.println("Message ID : " + MesId);
mes.readFully(strData);
qMgr.commit();




But ...My request message does not match with the reply message.
The qm GENERATES THE MESSAGE ID.The request messge id is put as the corrleation id in the reply message.BUt I am getting wrong replies.CAn anyone tell me what is wrong in my code.

Thanks in advance

regards
Shantha
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jun 27, 2004 10:25 am    Post subject: Reply with quote

Grand High Poobah

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

The correlation Id is only a String when using JMSCorrelationID. In base java you must treat it as a byte array: byte[]
Your first impulse was right. Set the message correlationid to the messageID of the requester message, after it has been sent.

By rote:
//send request message
...
//commit
qmgr.commit();
//get msg id
byte[] msgid = .....
//create new msg
....
//set correlation id to msgid
.....
//read message wait x
Back to top
View user's profile Send private message Send e-mail
shantha
PostPosted: Sun Jun 27, 2004 10:45 am    Post subject: Reply with quote

Apprentice

Joined: 11 Dec 2003
Posts: 41

HI Thanks for the reply
But it does not pick it up b'cas i=the correlation id in the reply messeg id,has some ascii charaters..whcih might not macth if i use..
mes.corrationId = sMessageID.getBytes()

SHantha
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jun 27, 2004 10:54 am    Post subject: Reply with quote

Grand High Poobah

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

It should not matter as both messageid and correlationid are byte arrays in base java. JMS translates the bytes into their Hex representation.
There is no consideration about ascii/ebcdic characters when we talk about messageid or correlationid because essentially you need to manipulate them at the byte level and not at the String level.

The server program is responsible for populating the correlation id. Just like the requester program it needs to manipulate the messageid and correlationid at the byte level. Otherwise all bets are off.

Image sending "mycorrelid" in ebcdic as correlationid.
You will never be able to match it to "mycorrelid" in ascii as the byte representation is not the same in ebcdic and in ascii.

Hope this clarifies it some
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sun Jun 27, 2004 10:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

shantha wrote:
HI Thanks for the reply
But it does not pick it up b'cas i=the correlation id in the reply messeg id,has some ascii charaters..whcih might not macth if i use..
mes.corrationId = sMessageID.getBytes()


Where is sMessageID populated? You don't show that in your code.

Is it a String? Why?

If you were sending a message, then you could save the MQMessage object that you sent, and then
Code:
mes.correlationID=sentMsg.messageID;


Have you looked through all the other messages on this forum that talk about this question?
_________________
I am *not* the model of the modern major general.
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 » Very very urgeent help required
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.