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 » How to get a pdf into the buffer (no referance messages)

Post new topic  Reply to topic Goto page Previous  1, 2
 How to get a pdf into the buffer (no referance messages) « View previous topic :: View next topic » 
Author Message
jed
PostPosted: Fri Dec 31, 2004 4:31 pm    Post subject: Reply with quote

Centurion

Joined: 08 Jan 2004
Posts: 118
Location: MI, USA

Lemme get this straight.....
You're just trying to GET messages that you've PUT, right?

In order to read all the messages in a queue... You just need to do...

iMsgLen = 50;
do
{
md.MsgId = MQMI_NONE;
md.CorrelId = MQCI_NONE;
msgLen = iMsgLen;

mqGet(connH, &queueH, &md, getOpt, msgLen, msg, &iMsgLen, &compCode, &reasCode);

} until (compCode != MQCC_OK)


I hope this helps you in getting the subsequent messages from the queue.
_________________
Jed
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
ironface
PostPosted: Tue Jan 04, 2005 2:05 am    Post subject: Reply with quote

Newbie

Joined: 28 Dec 2004
Posts: 8

Sorry to bother You again, but I misexplained my need.
I've got a queue with 4 old message. Using an application I put one another message and want to retrieve the reply message related.
In the PUT message I use:
...
md.CorrelId = MQCI_NEW_SESSION
MQPUT gHcon, gHobj, md, pmo, buflen, Buffer, CompCode, Reason
...

In the get message
...
Struc.MatchOptions = MQMO_MATCH_CORREL_ID
MQGET gHcon, gHobj, md, gmo, buflen, Buffer, messlen, CompCode, Reason
...

The issue is that the message retrieved is the oldest instead of the related.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 04, 2005 5:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

ironface wrote:
In the PUT message I use:
...
md.CorrelId = MQCI_NEW_SESSION
MQPUT gHcon, gHobj, md, pmo, buflen, Buffer, CompCode, Reason


DO NOT USE MQCI_NEW_SESSION.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ironface
PostPosted: Wed Jan 05, 2005 1:27 am    Post subject: Reply with quote

Newbie

Joined: 28 Dec 2004
Posts: 8

What should I use instead of MQCI_NEW_SESSION?
Back to top
View user's profile Send private message
kman
PostPosted: Wed Jan 05, 2005 2:54 am    Post subject: Reply with quote

Partisan

Joined: 21 Jan 2003
Posts: 309
Location: Kuala Lumpur, Malaysia

Ironface,
I think you should listen to Peter's suggestion. read the programming manual. But I take it you already did, but still got confused with all this.

I hope I can explain in a simple way.

You have two program - Sender, and Responder.
When Sender puts a request message, it either sets the messageid and/or correlid, or gets the queue manager to assigned the ids.
Keep in mind the messageid.

Once request message is received by Responder, it sends (put) a reply message into the reply queue for the Sender. During this time, the Responder copy the messageid (that what we normally do) and assign it to the correlid of the reply message.

The Sender is expecting a reply based on the messageid it sent earlier. Since the responder copied to the Correlid, your match option should be Match Correlid. When doing this, do not set the correlid at all.
Do Not use MQCI_NEW_SESSION.
First because it is wrong. Second, because that would give a totally new value, which the matching will fail.

There is a couple of sample programs that you should look for... mqsrv and mqreq that exhibit this scenario.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Wed Jan 05, 2005 5:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

On your PUT, specify MQCI_NONE for your Message ID AND your Correlation ID. ALSO specify MQPMO_NEW_MSG_ID.

Save the resulting Message ID.

On your GET,create a NEW mqmd, specify MQCI_NONE for your Message ID. Assign the correlation ID to the saved Message ID, and specify MQMO_MATCH_CORREL_ID in your match options.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Jan 05, 2005 10:09 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
On your PUT, specify MQCI_NONE for your Message ID AND your Correlation ID. ALSO specify MQPMO_NEW_MSG_ID

Now that's the "belt and braces" approach. You only need to do one or the other.
Quote:
specify MQCI_NONE for your Message ID. ... and specify MQMO_MATCH_CORREL_ID in your match options

And again.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jan 05, 2005 10:32 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I've always been told that the best defense is a good offense.

So at least *occasionally*, I program offensively.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kman
PostPosted: Wed Jan 05, 2005 4:35 pm    Post subject: Reply with quote

Partisan

Joined: 21 Jan 2003
Posts: 309
Location: Kuala Lumpur, Malaysia

The above are referring to the Sender program, and not the Responder. Had you chosse Jeff's earlier suggestion, i.e., MQCI_NONE for CorrelId on the Responder, your GET on the Sender will always fail.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Thu Jan 06, 2005 5:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

kman wrote:
The above are referring to the Sender program, and not the Responder. Had you chosse Jeff's earlier suggestion, i.e., MQCI_NONE for CorrelId on the Responder, your GET on the Sender will always fail.


Ahh. Responder!

Responders are a lot more complicated.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ironface
PostPosted: Mon Jan 17, 2005 3:36 am    Post subject: Reply with quote

Newbie

Joined: 28 Dec 2004
Posts: 8

Jefflowrey, EddieA, Kman, you're very kind in answering my questions.
First of all I want to assure You I red the topics in the MOSeries help and the ones present in the documentation area of this site. My problem is that I'm very new in MQ so some rules are difficult to be "digested".
Jefflowery Yo specify "On your GET,create a NEW mqmd, specify MQCI_NONE for your Message ID. Assign the correlation ID to the saved Message ID"... What I'm missing is to understand where I do receive the correlID, since the MQPUT in visual basic seems it doesn't return any value.
Thanks again for your help.
Back to top
View user's profile Send private message
kman
PostPosted: Mon Jan 17, 2005 6:29 pm    Post subject: Reply with quote

Partisan

Joined: 21 Jan 2003
Posts: 309
Location: Kuala Lumpur, Malaysia

Quote:
What I'm missing is to understand where I do receive the correlID, since the MQPUT in visual basic seems it doesn't return any value.


Code:
' Setup MQMD and MQPMO to their respective
  ' initial values
  MQMD_DEFAULTS pmd
  pmd.Format = MQFMT_STRING

  MQPMO_DEFAULTS pmo

  ' Get message to be "put" from the Put text box
  buflen = Len(txtPut.Text)
  Buffer = txtPut.Text
  MQPUT gHcon, gHobj, pmd, pmo, buflen, Buffer, CompCode, Reason
  cboAPIRC.AddItem "MQPUT: CompCode = " + Str(CompCode) + ", Reason Code = " + Str(Reason), 0


The pmo - put message option is here assumed to be defaults. This could mean MQPMO_NEW_MSG_ID, and MQPMO_NEW_CORREL_ID.
If you want to be sure, add these statement during your put.

pmo.Options = MQPMO_NEW_MSG_ID + MQPMO_NEW_CORREL_ID

You can print out on the display text for your message id and correlid.

textDisplayMsgId = pmd.MessageId
textDisplayCorrelId = pmd.CorrelId

The above are for the Sender program. In your Responder, follow Jeff's suggestion. So instead of using defaults, you set the correlId from the received message id. Much like;

Code:

pmd.CorrelId = gmd.MessageId 'this is the msg id from your get'


Then again, in your Sender, while getting for the reply, use the match correlid in the gmo.

Code:

gmo.MatchOptions = MQGMO_MATCH_CORREL_ID
gmd.CorrelId = pmd.MessageId 'this is the original put message id'


These bits of codes, I hope will help you to understand all this. I do not have a VB on my machine, so the above codes are not verified, but should be correct. Unless someone wants to verify this.
Back to top
View user's profile Send private message Yahoo Messenger
ironface
PostPosted: Thu Jan 20, 2005 8:16 am    Post subject: Reply with quote

Newbie

Joined: 28 Dec 2004
Posts: 8

Finally I succeded. Thanks a lot to all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ API Support » How to get a pdf into the buffer (no referance messages)
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.