Friday, September 28, 2012

WPS: Event Handling and it's usage in Business process

Introduction : Event handlers enable a running business process to react to events that might be triggered by a partner. By definition, events occur independently and asynchronously. There may be zero or multiple events at any time. Event handlers can be associated with either a scope or with the business process (which in turn is also a scope). When a scope starts, all associated event handlers are enabled. The event handlers belonging to a scope are disabled when the scope ends. If the scope ends with a fault, the processing of the event handler is terminated.
There are two types of events:
  • Incoming messages that correspond to a WSDL operation. A status query or a cancellation are common examples of such events. A correlation must be specified for the incoming messages.
  • Alarms that go off after a user-defined period of time, or when a predefined point in time is reached. You can specify alarm events to repeat after a specified period of time.
Events can happen at the following times:

    at any time during the Proce's lifetime
    any number of times (i.e. 0,1,2,...n times)

While a scope is active, the event handlers associated with that scope wait for specified events. If no event occurs while the scope is active, the event handler does nothing and is disabled when the scope completes. This behavior is different from a receive or pick activity: receive activity must encounter the message they are waiting for before processing can continue. Event handlers stop waiting after the associated scope has completed.
 If we use recive we have to wait for the request if we receive then only we can continue but in case of on event no need to wait to get the event.