Event Notification Nodes

From PresenceWiki
Revision as of 08:23, 11 January 2010 by Mattpryor (Talk | contribs)

Jump to: navigation, search

Event Notification Nodes

These Nodes allow for wait / notify behaviour between separate Tasks, or between separate Threads resulting from a Fork Execution Node.

For example, let's say that Task A splits into two threads using a Fork Execution Node:

http://www.international-presence.com/wikidocs/images/wait_event_task.png

The first branch queries an inventory database, and then goes on to do make Web Service calls to get currency exchange rates. While this is going on, another branch performs an LDAP query to retrieve the email addresses of managers. We don't want the email to be sent until the inventory query and price lookup is complete, so a Wait Node is placed before the Send Email and a "Send Event Notification" Node is placed after the "Lookup Currency Rates" Node.

So the expected order of execution is as follows:

  • 1) Start of Task
  • 2) Load Inventory
  • 3) Fork Exectution
    • 4) Lookup Currency Rates (in separate thread)
  • 5) LDAP Query
  • 6) Wait On Event
    • 7) Send Event Notification (in separate thread)
  • 8) Send Email
  • 9) End of Task.

Wait On Event

The Wait on Event Node pauses Task Execution until an expected message is received, usually from another Thread or a separate Task.

The expected Message is identified with an Event Identifier. This should be a string of text that is unique to this event. It is good practice to include the Task Name in the identifier to ensure that it does not get confused with another Event from a separate Task.

It is also possible to include Presence variable values or column values for the Event Identifier. If a column value is used, the Node will wait for multiple events before continuing.


http://www.international-presence.com/wikidocs/images/wait_for_event_dialog.png


You can also specify a Timeout value here. If the wait time exceeds the Timeout value an Exception will be raised which can be handled by an Error Handler Node.

Send Event Notification

The Send Event Notification Node raises Event messages that are consumed by "Wait On Event" Nodes, allowing them to continue execution.


http://www.international-presence.com/wikidocs/images/raise_event_dialog.png