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 » call readFully again and other readFully Problems

Post new topic  Reply to topic
 call readFully again and other readFully Problems « View previous topic :: View next topic » 
Author Message
frankzwo
PostPosted: Thu Sep 07, 2006 9:20 pm    Post subject: call readFully again and other readFully Problems Reply with quote

Newbie

Joined: 22 Dec 2005
Posts: 6

Hi,

i would like to call readFully twice but it is not possible.
I get an EOFException, can i read the Message again, after i have call the readFully method.

Thanks.

Frank


Last edited by frankzwo on Thu Sep 07, 2006 11:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
deepu4u
PostPosted: Thu Sep 07, 2006 10:20 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Jun 2005
Posts: 37

You can not do it again coz buffer has a offset which icsset to the end of buffer once you have done readFully(byte b[]).

To see how it works please use getDataOffset() method before readFully and after readFully(). After reafFully() it reached the end of message thats why you got EOFException.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
deepu4u
PostPosted: Thu Sep 07, 2006 10:22 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Jun 2005
Posts: 37

Anyways if you want to use readFully again then after first readFully() use Message.setDataOffset(0).
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
frankzwo
PostPosted: Thu Sep 07, 2006 11:55 pm    Post subject: Reply with quote

Newbie

Joined: 22 Dec 2005
Posts: 6

thanks

i would like to extract a part of the message, i have successfully readout the rf2header, but i have problem to read out the body of the message

if i access the body with

Code:

bodylength = this.m_messageSize-this.m_msgBodyOffset;
this.m_messageBodyByt = new byte[bodylength];
mqMsg.readFully(this.m_messageBodyByt, this.m_msgBodyOffset, bodylength);


i get an

java.lang.IndexOutOfBoundsException
at java.io.ByteArrayInputStream.read(ByteArrayInputStream.java:160)
at java.io.DataInputStream.readFully(DataInputStream.java:266)
at com.ibm.mq.MQMessage.readFully(MQMessage.java:549)

Exception, if the m_msgBodyOffset is > 0

bodylength is the length of the whole body part of the message
m_messageBodyByt is the buffer, which i would like to save this part
m_msgBodyOffset is the position, i would like to begin to read

thank you very much for your help

Frank
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 08, 2006 2:42 am    Post subject: Reply with quote

Grand High Poobah

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

Looks to me like you might be skipping the RFH header twice.
If you want to use the offset when reading the message again, reset to start of buffer before using your read.

Anyway I would use JMS. No hassles with RFH header there.
And with MQ Version 6 it even does targetClientMatching....

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Canimus
PostPosted: Tue Oct 02, 2007 8:32 am    Post subject: How did you read the MQRFH2 Header? Reply with quote

Newbie

Joined: 02 Oct 2007
Posts: 1

Hi,

I'm trying to read the header of a message in a Java Client Application.
I can retrieve the message fromthe Queue successfully but when open the message the first bytes I get are:

RFH ???????????(MQSTR ????????3???<mcd>.....

Is there any method to determine the size of the header?

Thanks,
HV
_________________
HV
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 02, 2007 2:20 pm    Post subject: Reply with quote

Grand High Poobah

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

Read the manual. The size of the header is contained in the fixed portion at the begining of the header.

However I would not reinvent the wheel. Either move to JMS (no RFH header hassles, all handled behind the scenes through JMS) or ask your sending JMS app to define its queues as target client = MQ (?targetClient=1).

Enjoy
_________________
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 » call readFully again and other readFully Problems
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.