Home > Articles > Operating Systems, Server > Microsoft Servers

  • Print
  • + Share This
This chapter is from the book

Event Waiting Activities

Some activities wait for an event, as the following sections illustrate.

EventDriven Activity

The EventDriven activity is a special kind of sequence where the first activity in the sequence must be an activity that waits for an event. This includes activities such as a WaitForData, WaitForQuery, WebServiceReceive, Delay, or a custom-built event-sink activity in a Local Communications Service project. The EventDriven activity can only be used in two specific places:

  • In a Listen activity. The Listen activity has two EventDriven activities in it when you add it to the workflow. You can drag additional EventDriven activities into a Listen, or you can use the context menu or the Add Branch action in the properties page.

  • In the Events tab of the workflow (see Figure 3.15). You can drag the EventDriven activity to where it says Drop EventDriven Activity Here. The Workflow Events page appears when you click the third icon from the left in the bottom-left tabs.

Figure 3.14

Figure 3.14 A Terminate activity.

Listen Activity

The Listen activity (shown in Figure 3.16) waits on multiple events at once. The Listen activity contains multiple EventDriven activities to achieve this. Only one event waiting activity (the first to receive an event) ever gets run in each execution of a Listen. When the event is received the subsequent activities in that sequence are executed as in a regular sequence.

Figure 3.15

Figure 3.15 The Workflow Events design surface.

Figure 3.16

Figure 3.16 A Listen activity with contained EventDriven activities.

Typically one of the paths in a Listen contains a Delay. The Delay activity is implemented as an event that occurs after a timeout.

The Listen activity in Figure 3.17 contains two EventDriven paths. The first one waits for a web service call into the workflow. The second one is a Delay. If the Delay timeout occurs first then the web service receive will stop and the workflow will continue with activities following the Delay.

  • + Share This
  • 🔖 Save To Your Account