Skip to content

Commit

Permalink
GITBOOK-5: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
Sipke Schoorstra authored and gitbook-bot committed Jan 12, 2025
1 parent 1ae5c64 commit 1328d3c
Show file tree
Hide file tree
Showing 27 changed files with 1,577 additions and 128 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 30 additions & 9 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,46 @@

## Getting Started

* [Concepts](getting-started/concepts.md)
* [Prerequisites](getting-started/prerequisites.md)
* [Packages](getting-started/packages.md)
* [Hello World](getting-started/hello-world.md)
* [Containers](getting-started/containers/README.md)
* [Docker](getting-started/containers/docker.md)
* [Docker Compose](getting-started/containers/docker-compose/README.md)
* [Elsa Server + Studio](getting-started/containers/docker-compose/elsa-server-+-studio.md)
* [Elsa Server + Studio - Single Image](getting-started/containers/docker-compose/elsa-server-+-studio-single-image.md)
* [Persistent Database](getting-started/containers/docker-compose/persistent-database.md)
* [Traefik](getting-started/containers/docker-compose/traefik.md)

## Application Types

* [Elsa Server](application-types/elsa-server.md)
* [Elsa Studio](application-types/elsa-studio.md)
* [Elsa Server + Studio (WASM)](application-types/elsa-server-+-studio-wasm.md)

***
## Guides

* [Concepts](concepts.md)
* [HTTP Workflows](guides/http-workflows/README.md)
* [Programmatic](guides/http-workflows/programmatic.md)
* [Designer](guides/http-workflows/designer.md)

## Docker
## Activities

* [Docker](docker/docker.md)
* [Docker Compose](docker/docker-compose/README.md)
* [Elsa Server + Studio](docker/docker-compose/elsa-server-+-studio.md)
* [Elsa Server + Studio - Single Image](docker/docker-compose/elsa-server-+-studio-single-image.md)
* [Persistent Database](docker/docker-compose/persistent-database.md)
* [Traefik](docker/docker-compose/traefik.md)
* [Control Flow](activities/control-flow/README.md)
* [Decision](activities/control-flow/decision.md)
* [MassTransit](activities/masstransit/README.md)
* [Tutorial](activities/masstransit/tutorial.md)

## Extensibility

* [Custom Activities](extensibility/custom-activities.md)

## Operate

* [Workflow Instance Variables](operate/workflow-instance-variables.md)
* [Workflow Activation Strategies](operate/workflow-activation-strategies.md)

## Optimize

* [Log Persistence](optimize/log-persistence.md)
6 changes: 6 additions & 0 deletions activities/control-flow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
description: This section covers all built-in control flow activities.
---

# Control Flow

71 changes: 71 additions & 0 deletions activities/control-flow/decision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Decision

The **Decision** activity models a decision that yields a `true` or a `false` outcome, and is analogous to C#'s `if` statement.

## Inputs

| Name | Type | Description |
| ----------- | ------------- | ----------------------------------------------- |
| `Condition` | `Input<bool>` | An expression that evaluates to a boolean value |

## Outcomes

| Name | Description |
| ----- | ------------------------------------------------- |
| True | Triggered when the condition evaluates to `true` |
| False | Triggered when the condition evaluates to `false` |

## Usage

The following workflow shows an example of how the `Decision` activity can be used inside a `Flowchart` activity.

{% code fullWidth="false" %}
```csharp
using Elsa.Workflows;
using Elsa.Workflows.Activities;
using Elsa.Workflows.Activities.Flowchart.Activities;
using Elsa.Workflows.Contracts;
using Endpoint = Elsa.Workflows.Activities.Flowchart.Models.Endpoint;

namespace ElsaServer.Workflows;

public class FlowDecisionWorkflow : WorkflowBase
{
protected override void Build(IWorkflowBuilder builder)
{
builder.Name = "Flow Decision Workflow";

var age = builder.WithVariable<int>();
var promptWriteLine = new WriteLine("What is your age?");
var readLine = new ReadLine(age);
var isAdult = new FlowDecision(context => age.Get(context) >= 18);
var adult = new WriteLine("You are an adult.");
var minor = new WriteLine("You are a minor.");
var finish = new Finish();

builder.Root = new Flowchart
{
Activities =
{
promptWriteLine,
readLine,
isAdult,
adult,
minor,
finish
},
Connections =
{
new(promptWriteLine, readLine),
new(readLine, isAdult),
new(new Endpoint(isAdult, "True"), new Endpoint(adult)),
new(new Endpoint(isAdult, "False"), new Endpoint(minor)),
new(new Endpoint(adult), new Endpoint(finish)),
new(new Endpoint(minor), new Endpoint(finish))
}
};
}
}
```
{% endcode %}

18 changes: 18 additions & 0 deletions activities/masstransit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# MassTransit

MassTransit is an open-source distributed application framework for .NET that provides a consistent abstraction on top of the supported message transports.

It enables .NET developers to model messages as C# types, which can then be sent & received. To receive messages, one would typically write a Consumer.

When using the MassTransit module with Elsa, there is an additional method of sending & handling messages; through workflow activities.

## Messages as Activities

Elsa makes it easy to send and receive messages that are modeled as .NET type. All you need to do is define your type and then register it with the MassTransit feature.

When a message type is registered, two new activities will be automatically available for use:

* Publish {activity type}
* {activity type}

The first activity will _publish_ your message. The second activity acts as a trigger and will start or resume your workflow when a message of this type is received.
30 changes: 30 additions & 0 deletions activities/masstransit/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Tutorial

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

{% code title="OrderCreated.cs" %}
```csharp
public record OrderCreated(string Id, string ProductId, int Quantity);
```
{% endcode %}

{% code title="Program.cs" %}
```csharp
services.AddElsa(elsa =>
{
// Enable and configure MassTransit
elsa.AddMassTransit(massTransit =>
{
// Register our message type.
massTransit.AddMessageType<OrderCreated>();
};
});
```
{% endcode %}

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.
27 changes: 0 additions & 27 deletions concepts.md

This file was deleted.

Loading

0 comments on commit 1328d3c

Please sign in to comment.