EugeneTes bd41609424 Add NATS JetStream publish + trigger activities
NatsPublish (CodeActivity) publishes a UTF-8 body to a subject with optional
Nats-Msg-Id dedup and ExpectedStream assertion. NatsTrigger (Trigger<string>)
starts a workflow per message on a specified stream/subject.

A single BackgroundService scans the trigger store for indexed NatsTriggers,
groups by (stream, subject), and runs one durable pull consumer per pair with
Explicit ack, so multiple Elsa instances share the workload at-least-once. A
mediator handler on WorkflowTriggersIndexed refreshes subscriptions when
workflows are published.

Wired via Nats:Url/User/Password (env-var overrides Nats__*, or short
NATS_URL/NATS_USER/NATS_PASSWORD fallbacks). Uses the NATS.Net v2 client so
wss:// works transparently.
2026-09-02 09:49:15 +00:00

Elsa Custom Server

Custom Elsa Workflows API server. Extends stock Elsa 3.x with our own activities.

Where activities live

src/Elsa.CustomServer/Activities/*.cs — anything marked [Activity(...)] under this folder is auto-registered via AddActivitiesFrom<Program>() in Program.cs.

To add a new node type in the Studio designer:

  1. Drop a new file under Activities/.
  2. Inherit from CodeActivity, CodeActivity<T>, or Activity for triggerable ones.
  3. Rebuild and redeploy — Studio picks it up automatically the next time it fetches the activity descriptors.

Example — see Activities/Shout.cs.

Local run

dotnet run --project src/Elsa.CustomServer

Listens on http://localhost:8080; API root is /elsa/api.

Docker

docker build -t elsa-custom-server .
docker run --rm -p 8080:8080 \
  -e Identity__Tokens__SigningKey="$(openssl rand -base64 64)" \
  elsa-custom-server

Deployment

Coolify builds this image from the Dockerfile at repo root when the app is created with build_pack: "dockerfile". The Studio (separate container running the stock elsaworkflows/elsa-studio-v3 image) needs its BACKEND__URL env var pointed at this server's /elsa/api.

Description
No description provided
Readme 97 KiB
Languages
C# 85.7%
HTML 10.7%
Dockerfile 3.6%