Integration activity libraries
Integration activity libraries add workflow steps that can call external services, exchange messages, move files, read data, wait for time, or load application context. They give workflow authors a common way to connect a process to an outside system while leaving the workflow engine responsible for sequencing, waiting, and resuming work. For the wider package and feature model, see Extension integration ecosystem.
Activity library model
An integration activity library is a set of workflow activities and the service boundary that supports them. A task activity performs an external action and returns a result or outcome. A trigger activity waits for an outside event and resumes the workflow when the event matches its settings.
The libraries use a small set of patterns to connect workflow state to outside systems:
| Pattern | Workflow role | Typical result |
|---|---|---|
| Action | Sends, writes, queries, or changes data in a service | Completion, output data, or a branch outcome |
| Trigger | Waits for a message, webhook, call, or service event | Workflow resumption with event data |
| Transport message | Carries a body plus routing or correlation data | A message for another workflow or system |
| Context provider | Loads or saves application data for the workflow | Shared context for later activities |
| Scheduler adapter | Runs delayed, timed, or recurring workflow work | A future workflow or activity execution |
This diagram shows the common shape of an integration workflow. The workflow may use several libraries in one process, but each library owns the boundary to its service.
flowchart LR
T[External trigger or schedule] --> N[Workflow data and context]
N --> A[Integration action]
A --> S[External service or store]
S --> O[Workflow output or message]
O --> R[Next activity or waiting trigger]
Activity inputs and outputs
Integration activities take workflow values as inputs and expose service results as outputs. The inputs commonly hold service names, destinations, message data, query text, file content, or a provider choice. This lets one activity participate in many workflows without embedding a single business process in the library.
Activities also expose service-specific metadata when it affects composition. Message activities can carry correlation data. Data activities can return records. Trigger activities can return the event payload that caused resumption. These values form the contract between one integration step and the next.
References: src/…/SendMessage.cs• L27-66 src/…/MessageReceived.cs• L48-82 src/…/ReadCsv.cs• L29-63
Feature and service boundaries
Each library is enabled as an optional feature of the host. The feature supplies the service client, provider, transport, or scheduler that the activities need. Workflow definitions therefore depend on a selected integration capability, while the activity remains focused on the workflow-facing contract.
The same activity shape can sit above different service choices. For example, storage activities use a storage provider, and scheduling features select Quartz or Hangfire as the workflow scheduler. The host must enable the matching feature and provide its external settings before the workflow can use the activity.
References: src/…/SaveFile.cs• L36-46 src/…/ModuleExtensions.cs• L15-39 src/…/HangfireSchedulerFeature.cs• L14-40
External service activities
External service libraries turn API operations into workflow steps. They normally provide an action activity for a request and may provide a trigger activity for service events. The workflow supplies the operation data, while the library supplies the service client and maps the response into workflow data.
Service action activities
Action activities are the main way a workflow changes an outside system. They cover operations such as sending an email, calling a GraphQL service, searching a directory, or using a provider API. The workflow can place these actions after a decision, inside a loop, or before a message is published.
The library keeps service access behind a client or provider boundary. Slack and GitHub activities obtain a client from a factory using a workflow token. The action can then use the same workflow contract for each service operation without making the workflow aware of the client construction.
References: src/…/SendEmail.cs• L20-24 src/…/SendGraphQLQuery.cs• L9-34 src/…/SearchLdapEntries.cs• L14-24 src/…/SlackActivity.cs• L9-29
Event trigger activities
Trigger activities connect a workflow to an event that happens outside the workflow. They declare what event or resource they match, wait for the matching input, and place the received payload in workflow state. The same pattern supports messaging events, communication events, webhooks, and incoming calls.
An event trigger can start a workflow or resume one that is waiting. Its match settings are part of the workflow definition. A message trigger can match a transport and topic, while a call trigger can match source or destination numbers. This allows one external event source to route work to many workflow definitions.
References: src/…/MessageReceived.cs• L12-16 src/…/MessageReceived.cs• L84-124 src/…/IncomingCall.cs• L15-24 src/…/IncomingCall.cs• L48-87
Service configuration boundaries
Service activities need a reachable service and valid access data. Some libraries take a connection or token as workflow input. Others use a named client or host-level options. The choice controls where operators manage the service boundary, but the workflow still receives the same kind of activity result.
Credentials and connection values must follow the repository's connection and secret rules rather than becoming business data in a workflow. A service activity that cannot obtain its client cannot complete the external action. The parent page, Extension integration ecosystem, describes how these optional capabilities fit into host composition.
References: src/…/SlackActivity.cs• L14-29 src/…/SqlQuery.cs• L27-42 src/…/UploadBlobActivity.cs• L20-37
Messaging and communication activities
Messaging and communication libraries let workflows exchange durable business signals and contact people or devices. Their common composition is event in, workflow decision, action out. The event payload and correlation values help the workflow connect an outside message to the right process instance.
Message publishing and receipt
Service bus libraries provide publishing or sending actions and message-received triggers. A send activity turns workflow data into a message for a queue, topic, or producer. A receive activity waits for the configured transport and returns both the message body and transport information when it resumes.
The transport contract can carry more than a body. Correlation IDs, local-workflow markers, subjects, content types, application properties, and schema choices can affect routing or message interpretation. Use these values when a process crosses workflow or service boundaries.
Kafka also supports a local message mode and optional schema filtering. Azure Service Bus supports queue or topic targets and subscriptions. MassTransit provides a generic publish activity for configured message types. These variants share the same workflow pattern even though their transport contracts differ.
References: src/…/ProduceMessage.cs• L14-60 src/…/MessageReceived.cs• L13-58 src/…/SendMessage.cs• L15-66 src/…/PublishMessage.cs• L14-45
Human and machine communications
Communication libraries turn workflow decisions into messages for people or conversations. Email focuses on recipients, content, and attachments. Slack provides service actions and event triggers. Telecom activities model a live call as a sequence of incoming events and call-control actions.
These libraries fit the same process shape as message transports, but their payloads have a stronger service meaning. An email failure can follow an error port. A phone trigger can resume a workflow with a call payload, and later activities can speak, play audio, gather input, or end the call. The workflow should keep the business decision separate from these channel-specific actions.
References: src/…/SendEmail.cs• L31-88 src/…/SendEmail.cs• L117-133 src/…/SlackTriggerActivity.cs• L7-27 src/…/IncomingCall.cs• L30-73
Storage and data activities
Storage and data libraries move workflow data between transient workflow state and durable or structured formats. They help a workflow receive files, save results, query records, and pass normalized data to later actions.
File and blob handling
Storage activities provide a provider-neutral file boundary and provider-specific cloud operations. File activities open or save content by path. Azure Storage activities upload content as a blob. Their inputs accept common workflow data forms such as streams, bytes, strings, or uploaded files, which makes them useful at HTTP and message boundaries.
File steps often pair with communication or data steps. A workflow can open a stored file, parse it, and send a report. It can also collect several files and save them as one archive before publishing a message. The storage path and provider remain separate from the business decision that selects the file.
References: src/…/OpenFile.cs• L8-29 src/…/SaveFile.cs• L12-34 src/…/SaveFile.cs• L48-90 src/…/UploadBlobActivity.cs• L11-49
Structured data and directory access
Data activities convert external data into workflow-friendly values. The CSV activity accepts text or file-like input and returns records. SQL activities evaluate a query, use a selected database client, and return query results. LDAP activities return serializable directory records and provide outcomes for no match, one match, or many matches.
These activities are useful as a read-transform-act chain. A workflow can read rows, choose a path based on the result, and send or store the selected data. Their outputs are the hand-off point to expressions, decisions, loops, and service actions.
References: src/…/ReadCsv.cs• L18-22 src/…/ReadCsv.cs• L65-75 src/…/SqlQuery.cs• L14-18 src/…/SqlQuery.cs• L68-88 src/…/SearchLdapEntries.cs• L57-60 src/…/SearchLdapEntries.cs• L90-105
Scheduling activities
Scheduling libraries control when workflow work runs rather than what outside service it calls. They support time-based triggers, delays, recurring schedules, and background activity execution. The scheduling feature selects the provider that owns the future work.
Workflow timing
Time activities express business timing inside a workflow. A workflow can wait until a date, delay for a period, or follow a recurring schedule before it continues. This makes time a visible part of the process instead of an external timer hidden in application code.
Timing commonly separates an external event from a later action. For example, a message can start a workflow, a delay can allow a response window, and a later branch can send a reminder or close the process. The scheduler must preserve the wait across process restarts when the workflow requires durable timing.
References: src/…/TimerBase.cs• L1-200 src/…/Timer.cs• L1-200 src/…/Delay.cs• L1-200 src/…/Cron.cs• L1-200
Scheduler choices
Quartz and Hangfire are alternative scheduler integrations. Quartz can install the scheduler and expose it for workflow scheduling or background activity scheduling. Hangfire supplies a workflow scheduler and adds its own persistence options. The host should select one scheduler path for each role and configure storage that matches the deployment model.
Clustered scheduling needs shared durable state and a consistent scheduler identity. Without that shared state, multiple host instances cannot safely coordinate future jobs. This is a deployment concern rather than a workflow-definition concern.
References: src/…/QuartzFeature.cs• L8-31 src/…/QuartzFeature.cs• L37-59 src/…/ModuleExtensions.cs• L23-39 src/…/HangfireSchedulerFeature.cs• L14-40
Workflow integration activities
Workflow integration libraries connect outside data to workflow execution itself. They provide context that several activities can use and let workflows pass application-specific state through a consistent provider contract.
Workflow context
A workflow context provider loads application data for a workflow and can save that data later. The context activity sets a provider parameter and asks the provider to load the related context. This lets a workflow use business data without making every integration activity know how that data is stored.
Context is best used as shared input for a process. A trigger can identify an order or customer, a context provider can load the matching record, and service activities can use the loaded values. The provider remains responsible for the application-specific load and save behavior.
References: src/…/IWorkflowContextProvider.cs• L5-18 src/…/SetWorkflowContextParameter.cs• L81-115 src/…/WorkflowContextWorkflowExecutionMiddleware.cs• L1-200
Composition patterns
The libraries combine into a few repeatable workflow shapes. The shape depends on whether the first outside interaction is an event, a read, or a scheduled time, but the middle of the process is usually the same: prepare data, apply a decision, perform an action, and either finish or wait for the next signal.
| Composition | Use |
|---|---|
| Trigger → context → service action | Start from an event and act with application data |
| Receive message → parse or query → publish message | Translate one transport contract into another |
| Open file → read data → store or notify | Process a file without coupling business logic to storage |
| Schedule → query or load context → communicate | Run a time-based reminder or report |
| External event → wait → follow-up action | Give a person or service time to respond before continuing |
This diagram shows how the same workflow can cross several activity libraries without changing the role of each stage.
sequenceDiagram
participant E as Event or schedule
participant W as Workflow
participant C as Context or data activity
participant X as External action
participant M as Message or response
E->>W: Start or resume
W->>C: Load and shape data
C-->>W: Context or records
W->>X: Apply business decision
X-->>W: Result or completion
W->>M: Notify or publish
References: src/…/MessageReceived.cs• L88-118 src/…/ReadCsv.cs• L65-75 src/…/SetWorkflowContextParameter.cs• L102-115 src/…/SendEmail.cs• L117-130
Change checklist
When these files or sections are changed, remember to consider these:
- Keep each trigger's match data aligned with the transport handler that delivers its payload. A changed queue, topic, subscription, schema, or event key can leave a workflow waiting without an error.
- Keep message body conversion and metadata contracts aligned between send and receive activities. This includes formatter choice, content type, correlation data, and local-workflow markers.
- Keep activity inputs and outputs aligned with the client or provider boundary. A provider change can affect workflow expressions even when the activity name stays the same.
- Keep storage input forms and output types compatible with the next activity. File streams, binary content, archives, and parsed records do not have the same lifetime or serialization behavior.
- Keep scheduler selection and scheduler storage aligned with the deployment shape. Clustered hosts need shared durable job state.
- Keep workflow context provider names and parameter scopes aligned with the activities and middleware that load them.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A message or service event does not match the trigger's configured transport, destination, or filter | The workflow remains waiting and no business action runs | Check the trigger's match settings against the external producer and event payload |
| A service client, token, connection, or provider is not configured | The action cannot reach the external system and the activity fails | Enable the matching feature and provide its host or workflow access settings |
| A message body or file uses a type that the activity cannot convert | The workflow fails before the next activity receives usable data | Normalize data at the boundary and choose the matching formatter or input form |
| A workflow expects a context provider or parameter that is not available | Context-dependent expressions receive no usable application data | Register the provider and keep its scoped parameter name consistent |
| Multiple scheduler hosts run without shared durable job state | Future work can run with unsafe coordination across hosts | Use a persistent scheduler store and configure clustering when the deployment needs it |
Key files
| File | Why to read it |
|---|---|
| src/…/MessageReceived.cs | Shows the receive-trigger contract, wait-and-resume behavior, and message outputs. |
| src/…/SendMessage.cs | Shows how workflow data becomes a transport message with routing metadata. |
| src/…/ProduceMessage.cs | Shows producer selection, correlation, local delivery, and schema-aware composition. |
| src/…/SendEmail.cs | Shows a communication action with attachments and an explicit error path. |
| src/…/IncomingCall.cs | Shows how a provider event matches several call conditions and resumes a workflow. |
| src/…/SaveFile.cs | Shows the provider-neutral file input boundary and multi-file composition. |
| src/…/ReadCsv.cs | Shows how external file data becomes records for later workflow decisions. |
| src/…/SqlQuery.cs | Shows the query, client, and result boundary for database integration. |
| src/…/ModuleExtensions.cs | Shows how a scheduler is selected for workflow and background work. |
| src/…/IWorkflowContextProvider.cs | Defines the load and save contract for application-specific workflow context. |
| src/…/SetWorkflowContextParameter.cs | Shows how a workflow supplies context parameters and loads provider data. |