Author |
Message
|
kolguri |
Posted: Tue Jan 18, 2011 1:26 pm Post subject: get mesages on groupid that runs into multiple unit of work |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
Hi,
we have an multithreaded application that puts messages to one central queue.
while putting messages from each thread , we are maintaining one group id for set of messages dropped by each multithreaded process.Also the messages with same group id can run into multiple unit of works as the application mq commits after eg every 3 messages that are put.
so the central queue has messages like
xxxxg1
xxxxg1
xxxxg1
Finally in the central queue we have messages from different processes interleved as below:
x1g1s1
x2g1s2
x3g1s3
y1g2s1
y2g2s2
y3g2s3
z1g3s1
z2g3s2
y4g2s4 (y4 is continued message of group g2 but arrived after z1,z2 in g3 as mq commit is after 3 msgs)
y5g2s5 (y5 is continued message of group g2 but arrived after z1,z2 in g3 as mq commit is after 3 msgs)
where (x1 x2 y1 y2.. are messages ,g1 g2 g3 are group ids, s1 s2..s5 are logical sequence numbers for messages in each group)
Now while reading these messages I want to read messages in logical sequence ie messages with one group has to retrived first then next group etc.
But even though after giving MQGMO-LOGICAL-ORDER and MQGMO-ALL-MSGS-AVILABLE to get options , I'm not getting all messages y1y2y3y4y5 at once insted i'm getting y1y2y3z1z2y4y5 (though the sequence numbers of g2 are incremented correctly 1 to 5)
I also added MQMO-MATCH-GROUP-ID TO MQGMO-MATCHOPTIONS .
And I'm performing the loop till (MQGMO-GROUPSTATUS = MQGS-LAST-MSG-IN-GROUP) .
Can you please let me know if Im missing anything or do I need to do any additional processing to retrive the messages in same group that are interlaved withe other group messages.
To be more specific, option before first get are given as
ADD MQGMO-ALL-MSGS-AVILABLE TO MQGMO-OPTIONS.
ADD MQGMO-LOGICAL-ORDER TO MQGMO-OPTIONS
get first message, process it UNTIL (MQGMO-GROUPSTATUS = MQGS-LAST-MSG-IN-GROUP).
In the process para I have logic to get next message and befor that gets Im using below option.
ADD MQMO-MATCH-GROUP-ID TO MQGMO-MATCHOPTIONS
Thanks, |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 18, 2011 1:34 pm Post subject: Re: get mesages on groupid that runs into multiple unit of |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kolguri wrote: |
I also added MQMO-MATCH-GROUP-ID TO MQGMO-MATCHOPTIONS . |
Where do you obtain & add the group id prior to first get? Or do you obtain it from the first get? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kolguri |
Posted: Tue Jan 18, 2011 2:55 pm Post subject: get mesages on groupid that runs into multiple unit of work |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
I just issued a mqget ,and I'm assuming the qmanager will take care of maintaining the groupid for that message and use it to fetch next message in that group as I'm giving MQGMO-LOGICAL-ORDER.
Also I gave
ADD MQMO-MATCH-GROUP-ID TO MQGMO-MATCHOPTIONS
which sets match-group-id to match options which should then get messages with that group. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jan 18, 2011 2:59 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I just issued a mqget ,and I'm assuming the qmanager will take care of maintaining the groupid for that message and use it to fetch next message in that group as I'm giving MQGMO-LOGICAL-ORDER. |
Nope. The GroupId (and/or MsgId and/or CorrelId) in the MQMD at MQGET time will determine which message of which message group will be retrieved from the queue. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
skoobee |
Posted: Tue Jan 18, 2011 10:24 pm Post subject: |
|
|
Acolyte
Joined: 26 Nov 2010 Posts: 52
|
Quote: |
Applications that want to retrieve messages and segments in logical order are recommended to specify MQGMO_LOGICAL_ORDER, as this is the simplest option to use. This option relieves the application of the need to manage the group and segment information, because the queue manager manages that information. |
This is all explained in the APG, MQGMO, Options field. If you think your app is meeting the conditions, then your group of msgs should be returned as required.
Review the conditions, and then raise a PMR. Send in a browse of the queue showing the msgs, and a trace of the msgs being retrieved in the wrong order. Prepare yourself for a reply which points out the condition you have overlooked. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 19, 2011 3:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bruce2359 wrote: |
Nope. The GroupId (and/or MsgId and/or CorrelId) in the MQMD at MQGET time will determine which message of which message group will be retrieved from the queue. |
And kinda suspected this was the problem. You're not the first to think this is handled automatically somehow. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kolguri |
Posted: Wed Jan 19, 2011 11:18 am Post subject: re:get mesages on groupid that runs into multiple unit of wo |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
Hi I tried saving the group id after first get and passed that group id whle retriving next message. But even if message of one group are at positions 1 2 6 7 in queue, while retriving its not retriving them in this order.
It is just doing a normal get as they appear in queue not group wise.
I trid to display group numbers and I see them change if next message is part of other group . |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 19, 2011 11:44 am Post subject: Re: re:get mesages on groupid that runs into multiple unit o |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kolguri wrote: |
I trid to display group numbers and I see them change if next message is part of other group . |
By this you mean the group sequence number which is unique within a given group?
So for each MQGet you're specifying:
MQGMO_LOGICAL_ORDER
MQGMO_ALL_MSGS_AVAILABLE
MQMO_GROUP_ID
and the same group id (the one from the 1st message in a particular group).
The result you're seeing is that you correctly obtain all the messages from a given group but they're retrieved in physical rather than logical order - yes? Just as if you'd not specified MQMO_MATCH_MSG_SEQ_NUMBER?
Have you also confirmed that the messages are not only put in the correct order, but the MQPMO_LOGICAL_ORDER is specified? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kolguri |
Posted: Wed Jan 19, 2011 12:33 pm Post subject: re:get mesages on groupid that runs into multiple unit |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
Yes I havnt mentioned MQMO_MATCH_MSG_SEQ_NUMBER.
Also I dropped messages in put application by specifing the MQPMO_LOGICAL_ORDER .
Also dos the queue need to be indexed on groupid? or any other settings needs to be done for queue or qmanager to get messages in logical order(groupwise) |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 19, 2011 1:01 pm Post subject: Re: re:get mesages on groupid that runs into multiple unit |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kolguri wrote: |
Yes I havnt mentioned MQMO_MATCH_MSG_SEQ_NUMBER. |
And yet you're surprised when
kolguri wrote: |
Also I dropped messages in put application by specifing the MQPMO_LOGICAL_ORDER . |
Good.
kolguri wrote: |
Also dos the queue need to be indexed on groupid? |
You didn't mention the queue was on z/OS.
kolguri wrote: |
or any other settings needs to be done for queue or qmanager to get messages in logical order(groupwise) |
Only as indicated above. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kolguri |
Posted: Wed Jan 19, 2011 1:15 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
VIitor I'm confused and cant understand? It is a z/os mq . Im writing code in cobol program. I havnt mentioned MQMO_MATCH_MSG_SEQ_NUMBER. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Jan 19, 2011 1:20 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
What do you want to accomplish here?
Do you want to get all of the messages in the group in logical order? Or a specific msg sequence number in the group? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
kolguri |
Posted: Wed Jan 19, 2011 1:24 pm Post subject: |
|
|
Newbie
Joined: 18 Jan 2011 Posts: 9
|
I just want all the messages in a group in logical order. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jan 19, 2011 1:49 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kolguri wrote: |
It is a z/os mq |
Then specifying an index will group all the same-grouped messages together and improve performance but AFAIK that doesn't guarantee sequence within group.
kolguri wrote: |
Im writing code in cobol program. |
Good for you.
If you think you've correctly configured grouping & sequencing as indicated here and you're still not getting messages back in order then I suggest you raise a PMR. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Jan 19, 2011 4:01 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
On the consuming app GMO_LOGICAL_ORDER+GMO_ALL_MSGS_AVAILABLE will do exactly what you want.
The app that creates the group will need to set the appropriate msg flag to indicate whether a particular message is a _MSG_IN_GROUP, and for the last message LAST_MSG_IN_GROUP.
I recall a sample program (in COBOL and C). Search for message group sample. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|