Processing events in a sequence

You can use an event sequencing qualifier to ensure that invocations to operations at run time will be processed in a predetermined sequence.

If you store customer data in a database, you might need to ensure that any updates to the customer data are processed in the order that they are received. If events are processed in parallel, the first update might be delayed and might overwrite a more recent update. You can establish a qualifier for such events to ensure that an update cannot be processed if there is already a request to update that customer record.

Event sequencing requires events to acquire a lock before they are dispatched to the target component to execute business logic. When the execution of the business logic completes, the event releases the lock.

Note: Because you are establishing a sequence where one task must complete before the next task can begin, you need to be careful how you apply this feature. Make sure that you are not going to tie up an essential process for an unacceptable time because you have included an event that might take a long time to complete.

You can establish a sequence for events related to a particular operation by following these steps:

  1. In the module assembly diagram, select the component you want to qualify. The component must have a WSDL interface; you cannot set event sequencing qualifiers on a component with a Java interface.
  2. In the Properties view, click the Details tab, which shows the component's interfaces and references. If you are trying to control the sequence relating to updating customer records, you would choose the component that controls those updates and establish a sequence based on the customer identification.
  3. Expand the tree and select an operation of the component's WSDL interface.
  4. Click Qualifiers, click Add, and select Event Sequencing from the list provided. The event sequencing qualifier is added to the operation. When you select that qualifier, you can see its properties in a subordinate view, shown below:

  5. In the Properties of Qualifier Event Sequencing view, click in the table cell for the first parameter and select the relevant parameter from the list provided. The parameters are business objects or simple types. In our example, you would choose the parameter that identifies the customer.
  6. Provide an XPath expression to identify the data type that will be used as the key that determines the sequence. You can type an XPath expression in the field provided, or you can select the table cell and click the ellipsis (...) button to open the XPath Expression Builder wizard, which will help you through the process. Just select a business object attribute, and the wizard will construct the XPath expression for you. The key for an event sequence is composed of two or more business object attributes. Attributes with the same key will be processed in the order shown.
  7. If you want to add more parameters, click Add and repeat steps 5 and 6. You can use the arrow buttons in the view to change the sequence by moving a parameter up or down.
  8. Save your changes in the assembly editor.