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 API Support » MQGET with Delphi only receive RFH?

Post new topic  Reply to topic
 MQGET with Delphi only receive RFH? « View previous topic :: View next topic » 
Author Message
edwardkoo
PostPosted: Tue Jan 19, 2010 3:06 am    Post subject: MQGET with Delphi only receive RFH? Reply with quote

Newbie

Joined: 19 Jan 2010
Posts: 6

Hi,

I am using Delphi to create an app that retrieve message from MQ server.
After call MQGET my app always only received a single RFH word. How do i get the complete message?

Following is the Delphi code i use to call MQGET

FHobj := 0;
Options := MQOO_FAIL_IF_QUIESCING + MQOO_INPUT_AS_Q_DEF;
ObjDesc := MQOD_DEFAULT;
ObjDesc.ObjectName := 'TESTQ2' + #0;
MQOPEN (FHconn, @ObjDesc, Options, @FHObj, @Compcode, @Reason );
if CompCode <> MQCC_OK then
ShowMessage('Open Failed' + IntToStr(Reason))

BufferLength := 1024; DataLength := 0;
MsgDesc := MQMD_DEFAULT;
GetMsgOptions := MQGMO_DEFAULT;
MQGET ( FHconn, FHobj, @MsgDesc, @GetMsgOptions,
BufferLength, Buffer, @DataLength, @Compcode, @Reason);
if CompCode <> MQCC_OK then
ShowMessage('GET Failed' + IntToStr(Reason))
Back to top
View user's profile Send private message
zonko
PostPosted: Tue Jan 19, 2010 3:26 am    Post subject: Reply with quote

Voyager

Joined: 04 Nov 2009
Posts: 78

I expect you are getting the complete msg, just not displaying it correctly.
For an RFH type msg, the first 4 characters are RFH space, which will display nicely. The next characters will be x00000002, and are non-printable characters.
So, if you are just displaying the buffer returned from MQGET, all you will see is the RFH space. You need to find another way to show the non-printable chars that follow.
Back to top
View user's profile Send private message
edwardkoo
PostPosted: Tue Jan 19, 2010 10:25 pm    Post subject: Reply with quote

Newbie

Joined: 19 Jan 2010
Posts: 6

Hi zonko,

You're right. Received complete msg of

RFH  ˜  ¸ ¸ <mcd><Msd>jms_bytes</Msd></mcd> L<jms><Dst>queue:///TESTQ2</Dst><Tms>1263959670182</Tms><Dlv>2</Dlv></jms> Test msg from TESTQ2


I think i will copy data start after </jms> tag. I guess that's pretty safe unless there could be more than one occurences of </jms> tag which should not be possible right?

Thanks.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jan 20, 2010 11:13 am    Post subject: Reply with quote

Grand High Poobah

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

edwardkoo wrote:
Hi zonko,

You're right. Received complete msg of

RFH  ˜  ¸ ¸ <mcd><Msd>jms_bytes</Msd></mcd> L<jms><Dst>queue:///TESTQ2</Dst><Tms>1263959670182</Tms><Dlv>2</Dlv></jms> Test msg from TESTQ2

I think i will copy data start after </jms> tag. I guess that's pretty safe unless there could be more than one occurences of </jms> tag which should not be possible right?

Thanks.

DON'T DO IT THIS WAY.
a) the RFH header has a field describing it's length. As such you can read the corresponding number of bytes from the message. The rest is then the payload.
b) Use the JNDI/URI in JMS to suppress the RFH2 header. A search of the site will give you the details...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jan 20, 2010 11:28 am    Post subject: Reply with quote

Grand High Poobah

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

edwardkoo wrote:
I think i will copy data start after </jms> tag. I guess that's pretty safe unless there could be more than one occurences of </jms> tag which should not be possible right?


Wrong. There might not be another <jms> tag, but there could easily be a <usr> tag, or any of the other tags the RFH2 can contain.

Follow the suggestions of my associate and either parse the RFH2 or suppress it. Don't just chop it up.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
edwardkoo
PostPosted: Wed Jan 20, 2010 6:50 pm    Post subject: Reply with quote

Newbie

Joined: 19 Jan 2010
Posts: 6

Hi guys,

I added this param

MsgDesc.Format := MQFMT_STRING;

and i receive only the content message without RFH header now.
Thanks.
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 API Support » MQGET with Delphi only receive RFH?
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.