Email: info@zenconix.com

Activities in WF 4.5

Published on: 02/26/15 12:09 PM

Category:Windows Workflow Foundation 4.5 Tags: , , , ,

Activities

Workflow is a list of predefined steps that are executed in a specific order to perform an outcome and that you can use them to model processes. Each step of a workflow is called an activity and one or more activities makes up a workflow. Just as the atom plays a role as the building block of the universe, activities are considered the basic building blocks that define a workflow.

Activities are the core unit of behavior in WF. The execution logic of an activity can be implemented in managed code or it can be implemented by using other activities.

WF activities are the basic unit of work and are used to execute code within a workflow. Understanding the functionality that each activity provides within WF is half the learning curve. By getting to know each activity, the skill for building efficient workflows becomes easier. WF4.x activities are categorized into 10 areas:

  • Control Flow: Models how business processes can flow within a workflow.
  • Flowchart: Provides the most transparency for modeling decision-making processes. Flowchart activities were introduced in WF4.

  • State-machine: Models possible transitions between the states of a workflow indicating human interaction and events within workflows.

  • Messaging: Provides communication functionality for building workflows that are exposed as services and communicate over transport protocols.

  • Runtime: Provides instructions to the WF runtime for how to manage workflow behavior.

  • Primitives: Provides general functionality around execution.

  • Transaction: Provides functionality for allowing activities to execute within a transaction so unwanted results can be reversed.

  • Collection: Provides basic functionality for managing data represented as collections within a workflow.

  • Error Handling: Provides functionality for hardening workflows by providing logic for managing unanticipated exceptions.

  • Migration: Provides functionality for allowing workflows built using WF3.x to execute in WF4.

Control Flow Activities

 

Activities

Description

DoWhile

Keeps executing child activities until the conditional expression is met.

ForEach

Executes child activities for each iteration of an enumerable collection.

Executes child activities within a single branch based on a condition.

Executes more than one branch of child activities at the same time asynchronously asynchronously within each iteration. Used to receive events outside of a workflow and serves as the trigger for when events occur. Usually a delay is used to wait for an external event for a given time. Branches for a Pick activity that contain a trigger for handing external events and an Actionactivity for processing logic. Holds a collection of child activities that are executed sequentially. Executes child activities based on a predetermined expression.

While

Continuously executes child activities while a condition is met.

Flowchart Activities

Activities

Description

Flowchart

Provide the canvas for modeling a flowchart workflow.

FlowDecision

Occurs when workflow instance is started.

FlowSwitch<T>

Executes child activities based on a predetermined expression.

 

State Machine Activities

Activities

Description

StateMachine

Provides the canvas and a default state for a state-machine workflow.

State

States represent the transitions that can be made within a state-machine workflow. Child activities can be added to the state activity when a state activity becomes active and when there is a transition to another state.

FinalState

Represents the last state for a state-machine workflow. Its icon is different from the other state’s icons, so that it how you identify it as the final state.

Messaging Activities

Activities

Description

CorrelationScope

Provides correlation management for child activities. Correlation is way to relate messaging activities.

InitializeCorrelation

Usually correlation is established when messages are sent or received; however, sometimes correlation needs to be established before actually sending or receiving a message.

Receive

Receives incoming messages sent to a workflow.

ReceiveAndSendReply

Follows the same pattern as a common web service that receives an incoming message and produces a reply that is sent back.

Send

Sends an outgoing message to a service.

SendAndReceiveReply

Correlation is used to send an outgoing message to a service and anticipates receiving a reply from the external service.

TransactionReceiveScope

Allows message received to be processed within transactions

Runtime Activities

Activities

Description

Persist

Tells the WF runtime that the workflow should be persisted and removed from memory

TerminateWorkflow

Tells the WF runtime that the workflow should terminate.

Primitives Activities

Activities

Description

Assign

Assigns values to objects within a workflow.

Delay

Temporary pauses execution of a workflow based on a predetermined amount of time

InvokeMethod

Allows existing code that was written outside of the workflow to be executed within a workflow

WriteLine

Writes a defined string of text that is written to a console window.

Transaction Activities

Activities

Description

CancellationScope

Allows cancellation logic to be executed to reverse unwanted execution results.

CompensableActivity

Defines work that needs to be done during normal execution of logic and work that needs to be done to compensate or reverse completed execution logic.

Compensate

Allows the workflow to start compensation.

Confirm

Allows confirmation to occur for normal or compensated work.

TransactionScope

Allows work that is executed within child activities to be executed within a transaction so it can be rolled back if needed.

Collection Activities

Activities

Description

AddToCollection<T>

Adds objects within a predefined collection.

ClearToCollection<T>

Clears all objects within a predefined collection.

ExistsInCollection<T>

Checks to see if an object is contained within a predefined collection.

RemoveFromCollection<T>

Removes an object contained within a predefined collection


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts