|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Delete message and queue depth |
« View previous topic :: View next topic » |
Author |
Message
|
GaryGWood |
Posted: Mon Jan 24, 2005 12:41 pm Post subject: Delete message and queue depth |
|
|
Apprentice
Joined: 14 Oct 2003 Posts: 48 Location: Austin, TX
|
I was asked this question and am not sure - hopefully I can articulate it so it makes sense.
Say I have a queue with 100 messages. Task 1 begins processing the messages on the queue but does not remove them (leaving the queue depth unchanged). Task 2 begins shortly after task 1 and deletes the first 10 messages from the queue before task 1 completes thus changing the queue depth to 90.
Will task 1 still process all 100 messages on the queue since it already processed the 10 deleted? Or will task 1,working on message 60 come back to get 61 and not be aware that the queue depth has "shifted" down, consequently skipping 10 messages?
Am I making sense?  |
|
Back to top |
|
 |
EddieA |
Posted: Mon Jan 24, 2005 1:34 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Task 1 begins processing the messages on the queue but does not remove them (leaving the queue depth unchanged) |
I guess you mean Browsing the messages.
Quote: |
Task 2 begins shortly after task 1 and deletes the first 10 messages from the queue before task 1 completes thus changing the queue depth to 90 |
In which case Task 1 won't get the 1st 10. If Task 2 Gets the 1st 10, while Task 1 is still processing somewhere between 1 and 10, then the messages are gone. Task 1 will continue reading with the next message avaialable to it, which will be message 11, but Task 1 thinks it's number 5 (or 6, or 4, or 8, depending where it was up to when Task 2 "ate" the messages).
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Jan 24, 2005 1:46 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Eddie, Gary meant this (I think),
Task1 browses messages 1-60. Its about to browse 61 when Task2 destructivly gets messages 1-10.
What will Task1 have returned on its next browse - 61, or 71?
I am not 100% sure, but I would guess 61.
What I am sure is this is not a good design. If need to insure Task1 broowses all the messages, it should open the queue exclusivly. What if Task2 is faster than Task1 and passes Task1? Then there is no doubt that Task1 will miss messages. I hope this is just an academic excercise and not a real app. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 24, 2005 1:48 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Messages wrote: |
2034 X'07F2' MQRC_NO_MSG_UNDER_CURSOR
An MQGET call was issued with either the MQGMO_MSG_UNDER_CURSOR or the MQGMO_BROWSE_MSG_UNDER_CURSOR option. However, the browse cursor is not positioned at a retrievable message. This is caused by one of the following:
The cursor is positioned logically before the first message (as it is before the first MQGET call with a browse option has been successfully performed).
The message the browse cursor was positioned on has been locked or removed from the queue (probably by some other application) since the browse operation was performed.
The message the browse cursor was positioned on has expired.
Corrective action: Check the application logic. This may be an expected reason if the application design allows multiple servers to compete for messages after browsing. Consider also using the MQGMO_LOCK option with the preceding browse MQGET call.
|
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
GaryGWood |
Posted: Mon Jan 24, 2005 2:43 pm Post subject: |
|
|
Apprentice
Joined: 14 Oct 2003 Posts: 48 Location: Austin, TX
|
Thanks everyone, it was primarily academic - we have mulitple applications that browse queues but the fear was what would happen if they actually got the message (through programmer oversight, cleanup tasks running unexpectedly, etc). Peter has is exactly right as far as my question goes.
Extending Peter's clarifiaction, if it does get 61, is that the 61 out of 100 or 61 out of 90 - they are different 61's. A preliminary test returned the 61 from the 100 set as though the number shift did not occur - almost as if the queue was cached (I know it's not but it the best description I have a the moment). |
|
Back to top |
|
 |
EddieA |
Posted: Mon Jan 24, 2005 3:05 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Ooops, my mis-understanding.
Quote: |
What will Task1 have returned on its next browse - 61, or 71? |
It will get the next message following the last one it got. It's "number" in the queue is irrelevent.
Quote: |
Extending Peter's clarifiaction, if it does get 61, is that the 61 out of 100 or 61 out of 90 |
Does it matter. Each Browse "cursor" will continue to get the next message available in sequence as it maintains it's position in the Queue. It doesn't know how many there are, in total.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
GaryGWood |
Posted: Tue Jan 25, 2005 8:13 am Post subject: |
|
|
Apprentice
Joined: 14 Oct 2003 Posts: 48 Location: Austin, TX
|
Fantastic, thank you Eddie and everyone else!  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|