Author |
Message
|
murared |
Posted: Thu Jan 16, 2014 1:29 am Post subject: How to know the message position after removing the message |
|
|
Novice
Joined: 16 Jan 2014 Posts: 17
|
Hello All,
Could you please help me in following action item?
Question: How to find the position of the message after removing the message from the queue using qload utility, the command used is,
./qload -m QM1 -I Q1 -f Q1.txt -da -s WELCOME
After entering this command, it has removed 2 messages out of 60 messages from the queue Q1. So i would like to know where these 2 messages sit on the queue in terms of position of the message.
Let us know if we need more information on this.
Thanks,
Reddy[/b] |
|
Back to top |
|
 |
exerk |
Posted: Thu Jan 16, 2014 2:29 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Please take more care in which forum you post in future; I have moved this post to a more appropriate forum. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 16, 2014 6:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There's no such thing as the position.
Forget this notion entirely.
Pretend that there was this notion.
There are 60 messages on the queue. You execute that qload command, and it removed the messages that were at position 10 and at position 12.
Then another application removes 20 messages from the front of the queue and adds 30 to the end of the queue.
What position were the messages at now? |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 16, 2014 6:35 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Messages arrive on a queue in the order they were MQPUT.
The message-delivery sequence attribute of the queue determines in which order messages are retrieved from a queue. Two possible MDS values: first-in-first-out (FIFO) or by message PRIORITY. _________________ 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 |
|
 |
murared |
Posted: Thu Jan 16, 2014 8:08 am Post subject: |
|
|
Novice
Joined: 16 Jan 2014 Posts: 17
|
Hi,
For quote
"There are 60 messages on the queue. You execute that qload command, and it removed the messages that were at position 10 and at position 12.
Then another application removes 20 messages from the front of the queue and adds 30 to the end of the queue.
What position were the messages at now?"
As this is queue, the messages which have put to the queue will be append from the last message irrespective of delivery sequence.
If i have 50 messages in the queue in which 2 messages have the string STAR should be removed which are positioned at 12th 15th place. Here, the application does not put the messages in between from 1 to 50 instead it needs ti put the messages from 51st place. So if the messages have been put dynamically there should not be position change of already existing messages in the queue until they are getting picked up from the queue. In this case, if i remove the messages "STAR" the position of the messages could not be change accordingly which positions i would like to find after removing the specific messages from the queue.
Please let me know if we need more clarification on this,
Thanks,
Reddy. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jan 16, 2014 8:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You're missing the point.
Yes, new messages are added at the end.
Yes, if there are fifty messages, and I go through and remove the message that is tenth from the front of the queue and then the message that is 15th from the front of the queue, then there are now 48 messages.
But when the 10th message was removed from the queue, all of the messages above it have now "moved position", so what was the 11th message is now the 10th message.
There's absolutely no meaning to the fact that a message was the tenth message from the front of the queue.
Forget the notion of position at all. it doesn't mean anything and it doesn't help you in any way.
A queue is not a table. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 16, 2014 8:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
murared wrote: |
Please let me know if we need more clarification on this, |
No, you need more clarity on how this works.
Messages are not put to a queue dynamically or staically; they're just put.
Messages are not put from the 51st place; they're just put.
If you have 50 messages on a queue and put another, it can legitimately be positioned at any point in the queue if the queue is not FIFO.
The notion of "position" does not exist, as my most worthy associate has explained. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 16, 2014 8:17 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
As mqjeff wrote, there is no WMQ concept of message position in a queue. Your application design may (try to) impose such a concept, but WMQ does not offer any primitive MQI call to MQGET the n-th message. Messages are not held in database table rows.
Why do you need to know the position of any message(s) in 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 |
|
 |
PaulClarke |
Posted: Thu Jan 16, 2014 11:57 am Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
I'm not sure I agree whole heartedly with previous comments that a message on a queue has no concept of position. Personally I feel it does. However, as has been mentioned before the position of a message can be very fleeting and therefore you have to be very careful if you use it for anything. MQ will not just arbitrarily shuffle messages around so as long as no one is putting or getting messages from a queue then the relative positions of the messages will remain the same. However, it can be quite rare that you have the luxury of a queue all to yourself.
I think the question that is really on peoples minds is....if you have removed messages by their content (ie they contained the string WELCOME) why do you care what position they were on the queue ? Essentially your questions seems to be asking for help in a solution without really telling us what the original problem was.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 16, 2014 1:47 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
PaulClarke wrote: |
I'm not sure I agree whole heartedly with previous comments that a message on a queue has no concept of position. Personally I feel it does. |
It's been my experience that many who are new to WMQ believe (imagine) that it stores messages in rows in database tables. Why not? WMQ uses DB2 infrastructure, doesn't it?
More than a few have attempted to design applications with database verbs in mind, like "inserting" a message based on some message content value. Others have proposed "relating" messages.
I believe it is in this sense that the OP believes that there is an opportunity to make use of message position in a 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 |
|
 |
PaulClarke |
Posted: Thu Jan 16, 2014 2:02 pm Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
It is amazing, over the years, how many products MQ is supposedly based on The first version of MQ did use the DB2 logger as a starting point. However, the logger is quite different from the queuing infrastructure. Queues are not like tables at all so a queue structure looks completely different to a database table. The two resource managers operate in a totally different way and have different performance characteristics. Tables tend to be write once, read many times (or WORM objects) where as queues tend to be write once, read once. This is is why a queuing system based on a database tends to perform very poorly.
Anyway, I think we need to hear from murared about his use of message position before we say it has no value in MQ.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
|