Integration Server 10.3 | Publish-Subscribe Developer’s Guide | Working with webMethods Messaging Triggers | Creating a webMethods Messaging Trigger | Using Multiple Conditions in a webMethods Messaging Trigger | Using Multiple Conditions for Ordered Service Execution
 
Using Multiple Conditions for Ordered Service Execution
You might create a webMethods messaging trigger with multiple conditions to handle a group of published documents that must be processed in a specific order. For each condition, associate one publishable document type with a service. Place your conditions in the order in which you want the services to execute. In the Processing mode property, specify serial document processing so that the webMethods messaging trigger will process the documents one at a time, in the order in which they are received. The serial dispatching ensures that the services that process the documents do not execute at the same time. (This assumes that the documents are published and therefore received in the proper order.)
Note:
Using multiple conditions to achieve ordered service execution is only supported for webMethods messaging triggers that receive messages from the webMethods Broker. webMethods Broker is deprecated.
You might want to use multiple conditions to control the service execution when a service that processes a document depends on another service successfully executing. For example, to process a purchase order, you might create one service that adds a new customer record to a database, another that adds a customer order, and a third that bills the customer. The service that adds a customer order can only execute successfully if the new customer record has been added to the database. Likewise, the service that bills the customer can only execute successfully if the order has been added. You can ensure that the services execute in the necessary order by creating a webMethods messaging trigger that contains one condition for each expected publishable document type. You might create a webMethods messaging trigger with the following conditions:
Condition Name
Service
Document Types
Condition1
addCustomer
customerName
Condition2
addCustomerOrder
customerOrder
Condition3
billCustomer
customerBill
If you create one webMethods messaging trigger for each of these conditions, you could not guarantee that the Integration Server would invoke services in the required order even if publishing occurred in that order. Specifying serial dispatching for the webMethods messaging trigger ensures that a service will finish executing before the next document is processed. For example, Integration Server could still be executing addCustomer, when it receives the documents customerOrder and customerBill. If you specified concurrent dispatching instead of serial dispatching, the Integration Server might execute the services addCustomerOrder and billCustomer before it finished executing addCustomer. In that case, the addCustomerOrder and billCustomer services would fail.
Important:
An ordered scenario assumes that documents are published in the correct order and that you set up the webMethods messaging trigger to process documents serially. For more information about specifying the document processing for a webMethods messaging trigger, see Selecting Message Processing.