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 » WebSphere Message Broker (ACE) Support » Not all MQ messages GET processed

Post new topic  Reply to topic
 Not all MQ messages GET processed « View previous topic :: View next topic » 
Author Message
Prashant_MQ
PostPosted: Thu Jul 27, 2006 11:22 pm    Post subject: Not all MQ messages GET processed Reply with quote

Apprentice

Joined: 07 Feb 2006
Posts: 28

Hi All,

I am facing a strange problem.

Scenario:

1.I trigger off the Request queue
2.PUT some test messages(No messages get processes-as the trigger OFF)
3.Now trigger ON the Request queue.
4.Only one message gets picked up instead of all of them although I have put a logic which checks for MQRC_MESSAGE_NOT_AVAILABLE.

Also below is the design for my code

1.CONNECT to queue manager
2.Repeat below steps until there are no messages on the queue
3.OPEN the request queue
4.GET the message
5.Process the message
6.PUT the reply message in the reply queue.
7.Loop around from step 2

I understand that once the application program terminates,there is an automatic disconnection from the queue manager.

Can anyone help me out on this.

Thanks
Prashant
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jul 27, 2006 11:34 pm    Post subject: Re: Not all MQ messages GET processed Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi Prashant_MQ,
Prashant_MQ wrote:
4.Only one message gets picked up instead of all of them although I have put a logic which checks for MQRC_MESSAGE_NOT_AVAILABLE.

What kind of exception handling are u doing ? Is your application failing or successfully ending ?
Are u doing a trigger every or first ?

Prashant_MQ wrote:
I understand that once the application program terminates,there is an automatic disconnection from the queue manager.

No, you should give a queue.close() and qm.close() before exiting...

You should put some print statements and check how ur code is working...

Regards.
Back to top
View user's profile Send private message Send e-mail
Mr Butcher
PostPosted: Thu Jul 27, 2006 11:48 pm    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

most common reason for an error like this (i get only first message) is, that the storage for holding MQMD and data is the same for all gets, and that msgid and correlid are not reset before the new get. So the first get works, but the second get fails, because the second get tries to read a message with the msgid and corelid from message 1.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
Prashant_MQ
PostPosted: Fri Jul 28, 2006 12:38 am    Post subject: Reply with quote

Apprentice

Joined: 07 Feb 2006
Posts: 28

I am using MQCLOSE

MQOPEN
MQGET
MQCLOSE

MQPUT-to reply queue

Can you confirm that MQCLOSE qill surely disconnect from the queue manager.

Becuase I need the connection handle since I am implemeting a GET in a LOOP.

Does it mean that I need issue MQCONN again before I do the next GET.(since I have issued MQCLOSE)

Please let me know
Thanks
Prashant
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Jul 28, 2006 12:56 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi Prashant_MQ,
Prashant_MQ wrote:

Becuase I need the connection handle since I am implemeting a GET in a LOOP.

Does it mean that I need issue MQCONN again before I do the next GET.(since I have issued MQCLOSE)

Don't connect and disconnect for every get....do a disconnect at the end of all picks...

But that is not the issue right ?
Prashant_MQ wrote:
4.Only one message gets picked up instead of all of them although I have put a logic which checks for MQRC_MESSAGE_NOT_AVAILABLE.

This seemed to be your issue...

Regards.
Back to top
View user's profile Send private message Send e-mail
wschutz
PostPosted: Fri Jul 28, 2006 3:23 am    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

The model you should use for a triggered program is:
Code:
MQCONN
MQOPEN input queue
loop until MQGET fails
MQGET with wait and reset msgId/correlID
if MQGET worked
    process message
    MQPUT1 to reply queue
end-loop
MQCLOSE
MQDISC
If you close the queue while messages are still on it (which appears to be the case here), the qmgr will create another trigger messsage and you'll have two copies of your program running.
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
Prashant_MQ
PostPosted: Mon Jul 31, 2006 5:40 am    Post subject: Reply with quote

Apprentice

Joined: 07 Feb 2006
Posts: 28

Wayne,

I have coded exactly the same way as you have mentioned in your reply below.

At the same time I tried to understand the exact mening of trigger type FIRST and EVERY.


Here is what happened-

I put the loop(to get messages until there are none) with trigger type EVERY,it did not work.Only one message gets processed each time a message is put in the queue(when there are already messages lying on the queue)

I changed the trigger type to FIRST and all the messages got picked up-note that loop is still present in the code.

Now I removed the loop(for get messages)-trigger off the queue --put 3 messages,the messages stayed in the queue which is valid.

I triggered on the queue(note that the trigger type is FIRST),although there was no loop(to get messages) all messages disappeared.

How is this possbile.What I understand is that for trigger type FIRST all messages will be processed until there are none on the queue(this should be done by the application program) as only one trigger message is created.

I am getting confused.I dont undertsand if my code is incorrect or it is the magic of trigger type.I guess there is some attribute which tells the program that there are more messages and you need to pick them all instead of specifically having the loop in the code.

Please clarify my doubts.

Thanks in advance
Prashant
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 31, 2006 5:51 am    Post subject: Reply with quote

Grand High Poobah

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

The way to tell if a queue is empty is the 2033 reason code; there is an attribute as you say (CURRDEPTH) but it's a long winded way round a simple problem!!!

Staying with the concept of simple can you confirm:

a) When all the messages disappeared after FIRST, the version of your application really didn't have the loop in it. It's so easy to accidently run the wrong version when you've chopping and changing.

b) The test really was with FIRST not EVERY. Again it's a simple thing and no offence is intended but it really is so easy to do.

It sounds like your understanding is correct but you have some code or setup issue.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Jul 31, 2006 5:51 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Use MQGET with MQGMO_WAIT and set the wait interval to a reasonable value (eg 5 seconds) - even when using triggering and a loop.

The reasons are (1) sometimes a trigger can be set before the messages are available and (2) more messages might arrive very shortly after the last one, so it saves triggering the program again within a short period.
Back to top
View user's profile Send private message
Prashant_MQ
PostPosted: Mon Jul 31, 2006 6:04 am    Post subject: Reply with quote

Apprentice

Joined: 07 Feb 2006
Posts: 28

I confirm on the below points

a) When all the messages disappeared after FIRST, the version of your application really didn't have the loop in it. It's so easy to accidently run the wrong version when you've chopping and changing.

Yes,there is no loop in the code and trigger tpye is FIRST.

b) The test really was with FIRST not EVERY. Again it's a simple thing and no offence is intended but it really is so easy to do.

Yes,test was for FIRST.

I shall wait for the CICS regions to bounce try and test this tomorrow again.

I guess this one is going to ruin my tonight's sleep.

Anyways,thanks all for your replies.I will be back tomorrow with some more test results.

Prashant
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 » WebSphere Message Broker (ACE) Support » Not all MQ messages GET processed
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.