|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	| How to get a pdf into the buffer (no referance messages) | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | jed | 
			  
				|  Posted: Fri Dec 31, 2004 4:31 pm    Post subject: |   |  |  
		  |  Centurion
 
 
 Joined: 08 Jan 2004Posts: 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 |  |  
		  |  |  
		  | ironface | 
			  
				|  Posted: Tue Jan 04, 2005 2:05 am    Post subject: |   |  |  
		  | Newbie
 
 
 Joined: 28 Dec 2004Posts: 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 |  |  
		  |  |  
		  | jefflowrey | 
			  
				|  Posted: Tue Jan 04, 2005 5:24 am    Post subject: |   |  |  
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 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 |  |  
		  |  |  
		  | ironface | 
			  
				|  Posted: Wed Jan 05, 2005 1:27 am    Post subject: |   |  |  
		  | Newbie
 
 
 Joined: 28 Dec 2004Posts: 8
 
 
 | 
			  
				| What should I use instead of MQCI_NEW_SESSION? |  |  
		  | Back to top |  |  
		  |  |  
		  | kman | 
			  
				|  Posted: Wed Jan 05, 2005 2:54 am    Post subject: |   |  |  
		  | Partisan
 
 
 Joined: 21 Jan 2003Posts: 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 |  |  
		  |  |  
		  | jefflowrey | 
			  
				|  Posted: Wed Jan 05, 2005 5:56 am    Post subject: |   |  |  
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 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 |  |  
		  |  |  
		  | EddieA | 
			  
				|  Posted: Wed Jan 05, 2005 10:09 am    Post subject: |   |  |  
		  |  Jedi
 
 
 Joined: 28 Jun 2001Posts: 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 |  |  
		  |  |  
		  | jefflowrey | 
			  
				|  Posted: Wed Jan 05, 2005 10:32 am    Post subject: |   |  |  
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 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 |  |  
		  |  |  
		  | kman | 
			  
				|  Posted: Wed Jan 05, 2005 4:35 pm    Post subject: |   |  |  
		  | Partisan
 
 
 Joined: 21 Jan 2003Posts: 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 |  |  
		  |  |  
		  | jefflowrey | 
			  
				|  Posted: Thu Jan 06, 2005 5:26 am    Post subject: |   |  |  
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 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 |  |  
		  |  |  
		  | ironface | 
			  
				|  Posted: Mon Jan 17, 2005 3:36 am    Post subject: |   |  |  
		  | Newbie
 
 
 Joined: 28 Dec 2004Posts: 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 |  |  
		  |  |  
		  | kman | 
			  
				|  Posted: Mon Jan 17, 2005 6:29 pm    Post subject: |   |  |  
		  | Partisan
 
 
 Joined: 21 Jan 2003Posts: 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 |  |  
		  |  |  
		  | ironface | 
			  
				|  Posted: Thu Jan 20, 2005 8:16 am    Post subject: |   |  |  
		  | Newbie
 
 
 Joined: 28 Dec 2004Posts: 8
 
 
 | 
			  
				| Finally I succeded. Thanks a lot to all. |  |  
		  | Back to top |  |  
		  |  |  
		  |  |  |  
 
 
  
  	| 
		
		  | 
 
 | 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
 
 |  |  |  |