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 » Serial Execution of Messages

Post new topic  Reply to topic
 Serial Execution of Messages « View previous topic :: View next topic » 
Author Message
vmurali_au
PostPosted: Tue Aug 15, 2006 5:51 am    Post subject: Serial Execution of Messages Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

I'm having a problem with designing MB flows

I'm having 2 flows: Router flow & Transformation flow. I can receive both Inquiries and Update messages from different users say from 0000 to 9999 in my Router flow.

A program X puts these messages in the router input queue. I want to execute the messages receieved from a particular user in the order they are received. So i'm planning to use the "ORDER MODE = BY USERID" option in the router message flow.

For that the program X has to set the UserID field of the MQ message as one of the values from 0000 to 9999. These values are not OS userid values. Is it allowed to set some value for userid other than a OS user value in the MQMD?

Also even if i set the order mode property of the message flow, and have multiple instances of router flow i still have doubt regarding serialization. Consider the scenario, messages M1, M2 and M3 are received from user 0000 in that order and M4, M5 from user 1111. Now as i've set the property of message flow to be "Order Mode = by UserID", my 1st router instance R1 will process the message M1, router instance R2 will wait on message M2 and R3 on M3. Router flow instance R4 can process the message M4 as it is from a different user.
Now when the processing of M1 is complete, whether R2 will start its work or R3 will start working? How is the order preserved here?

I read from InfoCenter that when "Order Mode = by UserID" then the additional flow instances will wait on the previous instance working on the message from the same user to complete.

Hope i've made myself clear here.

Thanks in Advance
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Aug 15, 2006 6:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So let's suppose you have user A and user B.

On your queue, you have 5 messages, in this order.

1. User A Insert
2. User B Update
3. User A Update
4. User A Insert
5. User B Insert

Do you want to process these messages in the order 1,3,4,2,5? Or do you just want to make sure that you don't process 3 before 1 and 5 before 2?

Also, this is called "message affinity", and is a pattern to avoid.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vmurali_au
PostPosted: Tue Aug 15, 2006 6:32 am    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

Thanks a lot Jeff.

I just want my flow to execute 1,3,4 in order and 2,5 in order. i.e, messages from same user are to be executed in order. I'm sure that "ORDER MODE = BY USERID" will solve it. But i want to confirm that once processing of message 1 is complete, and then 3 will be executed and then 5 will be. The reason is i will be having multiple instances of message flow and hence when message 1 is getting processed 2 more flow instances can wait on messages 3 and 4. So once message 1 processing is complete whether 3 will be processed or it will be 4? Will it be according to order of those messages in the queue? or in some random order for a user?. I'm sure it will be in Queue Order, but i just want a confirmation.

Consider this example of messages from a user X,

Create PO
Update PO
Delete PO

The messages from the user should be executed in order. So if i have multiple instances of flows processing these messages, then message execution will be inorder for that user and not as

Create PO
Delete PO
Update PO

I know this a crazy question
Back to top
View user's profile Send private message
vmurali_au
PostPosted: Tue Aug 15, 2006 6:35 am    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

Also Jeff can i set the UserID field of MQMD to any crap (12 byte char) value before i put it a input queue of a message flow? Or does broker does any validation on that field?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Aug 15, 2006 6:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Right, so you're only interested in making sure that messages for User 1 are processed in order, and not that all messages for user 1 are processed before all messages for user 2.

Again, this is an issue of message affinity, and is a pattern to avoid if possible. What if the user issues the messages in Create, Delete, Update? Are you supposed to process them in the "right" order, or just the order the user sent?

What the documentation says is that if you use Order By User ID, then when one instance of a flow processes the first message from User 1 on the queue, then no other instance will process any messages from User 1. Other instances will process messages for other users, if they are available.

So, if the queue is full of messages from User 1 - then you will only ever have one instance processing messages, and they will be processed in the order they have on the queue.

If the queue is full of messages for more than one user, then each user's messages will be processed in the order they are on the queue - but you can't guarantee which instance will process them. And you can't guarantee that User 1's messages will be processed before User 2's messages.

So
1. User 1 message 1 - instance 1
2. User 1 message 2
3. User 2 message 1 - instance 2
4. User 3 message 1 - instance 3
5. User 2 message 2
6. User 4 message 1
7. User 3 message 2
8. User 1 message 3

You can't guarantee that message 2 will be procesed before message 5, 6 or 7.
You can't guarantee that message 7 will be processed before messages 2, 5 or 7.
etc.

You can guarantee that message 2 will be processed after message 1 and before message 8.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vmurali_au
PostPosted: Tue Aug 15, 2006 7:25 am    Post subject: Reply with quote

Voyager

Joined: 26 Mar 2004
Posts: 76

jefflowrey wrote:

You can guarantee that message 2 will be processed after message 1 and before message 8.


Thanks jeff.

Messages submitted by an user will be executed in FIFO order even if there are multiple flow instances. That is what i wanted a confirmation on. I know "Order Mode = By UserID" means that . Thanks for confirming it.

Right now the client doesnt want the order to be maintained for operations submitted across by different users. Weird it may seem, but thats what the client wants

But the order should be maintained for operations submitted by individual users. I guess our design with "Order Mode = By UserID" will take care of it.

Thanks once again.
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 » Serial Execution of Messages
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.