LogoLogo
GitHub
  • Elsa Workflows 3
  • Getting Started
    • Concepts
    • Hello World
    • Prerequisites
    • Packages
    • Containers
      • Docker
      • Docker Compose
        • Elsa Server + Studio
        • Elsa Server + Studio - Single Image
        • Persistent Database
        • Traefik
  • Application Types
    • Elsa Server
    • Elsa Studio
    • Elsa Server + Studio (WASM)
  • Guides
    • HTTP Workflows
      • Programmatic
      • Designer
    • External Application Interaction
    • Loading Workflows from JSON
    • Running Workflows
      • Using Elsa Studio
      • Using a Trigger
      • Dispatch Workflow Activity
  • Activities
    • Control Flow
      • Decision
    • MassTransit
      • Tutorial
  • Expressions
    • C#
    • JavaScript
    • Python
    • Liquid
  • Extensibility
    • Custom Activities
  • Reusable Triggers (3.5-preview)
  • Multitenancy
    • Introduction
    • Setup
  • Operate
    • Variables
    • Activation Strategies
    • Incidents
      • Strategies
      • Configuration
    • Alterations
      • Alteration Plans
        • REST API
      • Applying Alterations
        • REST API
        • Extensibility
  • Optimize
    • Log Persistence
    • Retention
  • Hosting
    • Distributed Hosting
Powered by GitBook
On this page
  1. Activities
  2. MassTransit

Tutorial

The following example highlights creating and registering a fictive message type called OrderCreated.

OrderCreated.cs
public record OrderCreated(string Id, string ProductId, int Quantity);
Program.cs
services.AddElsa(elsa =>
{
    // Enable and configure MassTransit
    elsa.AddMassTransit(massTransit =>
    {
        // Register our message type.
        massTransit.AddMessageType<OrderCreated>();
    };
});

With the above setup, your workflow server will now add two activities that allow you to send and receive messages of type `OrderCreated`:

  • Order Created

  • Publish Order Created

The Order Created activity acts as a trigger, which means that it will automatically start the workflow it is a part of when a message is received of this type. The Publish Order Created activity will publish a message of this type.

PreviousMassTransitNextC#

Last updated 4 months ago