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 » Can not get the value from readString outside the method

Post new topic  Reply to topic
 Can not get the value from readString outside the method « View previous topic :: View next topic » 
Author Message
hgrant
PostPosted: Wed Feb 02, 2005 6:53 pm    Post subject: Can not get the value from readString outside the method Reply with quote

Newbie

Joined: 02 Feb 2005
Posts: 2

The problem im having is that outside of the method that I get the message off the queue I can not get the string with readString. It will correctly give me the length but when i try to do a readstring(length) it throws the IOException error. Here is a sample of the code below. The queues are clustered

THIS IS THE METHOD CALL
public void call()
{
MQMessage msg = getOutQueue();
int temp = msg.getTotalMessageLength();
try
{
//this will not print the message and throws IOException
System.out.println("MSG ="+msg.readString(temp));
return theMessage;
}
catch(IOException e)
{}
}
THE ACTUAL METHOD and returns type MQMESSAGE
public MQMessage getOutQueue()
{
MQMessage theMessage = new MQMessage();
getSeqMO.options = MQC.MQGMO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;
getSeqMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
theMessage.encoding = MQC.MQENC_NATIVE;
theMessage.characterSet = MQC.MQCCSI_Q_MGR;
theMessage.correlationId = seqNum.getBytes();
theMessage.messageId = seqNum.getBytes();
getSeqMO.waitInterval = getTime;
queue.get(theMessage, getSeqMO);
int length = theMessage.getTotalMessageLength();
String temp = theMessage.readString(length);
System.out.println(temp)//this will print correctly
return theMessage;
}


Thanks for any help
Back to top
View user's profile Send private message
hgrant
PostPosted: Thu Feb 03, 2005 9:23 am    Post subject: Reply with quote

Newbie

Joined: 02 Feb 2005
Posts: 2

To answer my question with the read call, the pointer has moved to the end and then calling the read again its reading beyond the buffer and the IOException is thrown with end of file. The pointer has to be reset to the beginning of the MQMessage
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 » Can not get the value from readString outside the method
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.