Skip to content

Activity Send Event Action Node

Mikołaj Milewski edited this page Oct 27, 2026 · 1 revision

Send Event Action Node

A Send Event Action Node constructs an event and sends it to a selected behavior. It represents an asynchronous communication step in an Activity; the outgoing flow continues after the send action completes. The target is selected as a BehaviorId.

sequenceDiagram
    participant Activity
    participant Target as Target behavior
    Activity->>Target: Send event
    Target-->>Activity: Event handling result
    Activity->>Activity: Continue outgoing flow
Loading

Definition

Provide an event factory and a target selector. The selector may use the action context and input tokens to choose the recipient.

public sealed record ShipmentReady(string OrderId);

The following fragment belongs inside the relevant method or builder callback:

.AddSendEventAction<ShipmentReady>(
    "NotifyShipping",
    async c => new ShipmentReady(
        c.GetTokensOfType<string>().Single()),
    async c => new BehaviorId(
        "StateMachine", "Shipping", "shipping-default"),
    node => node.AddControlFlow("Continue"))
.AddAction("Continue", async c =>
    await audit.RecordAsync("shipping-notified", c.CancellationToken))

The action looks up the selected behavior and awaits SendAsync if it is locatable. If it is not locatable, the current implementation skips the send; it does not synthesize a local token or turn that miss into an action exception. Ensure the target is discoverable when delivery is required. For receiving events, see Accept Event Action Node; for a notification that does not select a target behavior, see Publish Event Action Node.

Overview
Installation
Runtimes
   Orleans runtime
Concepts
   Events and Structural Events
   Messaging Patterns
   Validation
   Scheduling
   Observability
Behaviors
   Behavior Values
   Dependency Injection
   Behavioral Groups
   State Machines
       Concepts
           State Identity
           In-State Event Deferrals
           Evaluation of Transitions
           Exception Handling
       Building blocks
           Regions
           States
               State
               Composite State
               Orthogonal State
               Final State
           Pseudostates
               Choice
               Junction
               Fork
               Join
               History
           Transitions
               Transition
               Default Transition
               Internal Transition
   Activities
       Concepts
           Exception Handling
           Implicit Fork and Join
           Tokens
       Building blocks
           Nodes
               Action Node
               Decision Node
               Merge Node
               Initial Node
               Final Node
               Input Node
               Output Node
               Fork Node
               Join Node
               Accept Event Action Node
               Send Event Action Node
               Publish Event Action Node
               Time Event Action Node
               Data Store Node
               Structured Activity Node
               Iterative Activity Node
               Parallel Activity Node
           Flows
               Data Flow
               Control Flow
   Actions
   Entities
       Fields
       Mutations
       Projections
Extensions
   ClearScript
   FluentValidation
   JSON definitions
   Minimal APIs
   OneOf
   OpenTelemetry
   PlantUML
   Scheduling

Clone this wiki locally