elsa-core/samples/aspnet/Elsa.Samples.AspNet.DynamicActivityProvider
Sipke Schoorstra 283824fcfd
Enable Proto Actor Tracing for TraceLens (#5800)
* Add database initialization script and update dependencies

Added a script to initialize the 'tracelens' database and modified the Docker setup to include this script. Refactored and improved the ProtoActorFeature class, added OpenTelemetry dependencies, and updated project settings.

* Enable OpenTelemetry integration for Proto.Actor

Added OpenTelemetry environment configuration details to the README and included the Proto.OpenTelemetry package in the project file. Updated the ProtoActorFeature to apply tracing with OpenTelemetry to WorkflowInstanceActor.

* Refactor VariablePersistenceManager to use primary constructor

This refactor simplifies the VariablePersistenceManager by moving the storageDriverManager initialization into the primary constructor. It removes the redundant field and constructor, aligning with the concise nature of modern C# syntax, and ensures consistency in accessing the storageDriverManager throughout the class.

* Remove unused Open Telemetry code from Program.cs

The code for configuring Open Telemetry was commented out but not removed, cluttering the file. This commit cleans up Program.cs by deleting these unused lines, maintaining a cleaner and more readable codebase.

* Add metrics and tracing configurations for ProtoActorFeature

Introduced methods to enable metrics and tracing in ProtoActorFeature. Removed redundant properties and updated the workflow runtime to utilize the new configurations.

* Add Directory.Build.props for shared project settings

Introduce Directory.Build.props to centralize common project settings and dependencies. Consolidate target framework, language version, and package references to reduce duplication. Remove redundant property definitions from Elsa.Server.Web.csproj.

* Move apps from bundles to apps folder and Elsa module to modules folder
2024-07-19 20:23:32 +02:00
..
ActivityProviders Move samples to repository root 2024-02-02 20:01:14 +02:00
Data Move samples to repository root 2024-02-02 20:01:14 +02:00
Models Move samples to repository root 2024-02-02 20:01:14 +02:00
Properties Move samples to repository root 2024-02-02 20:01:14 +02:00
Workflows Test workflows housekeeping (#5092) 2024-03-19 13:51:18 +01:00
appsettings.Development.json Move samples to repository root 2024-02-02 20:01:14 +02:00
appsettings.json Move samples to repository root 2024-02-02 20:01:14 +02:00
Elsa.Samples.AspNet.DynamicActivityProvider.csproj Enable Proto Actor Tracing for TraceLens (#5800) 2024-07-19 20:23:32 +02:00
Program.cs Update project reference and cleanup code 2024-04-05 20:17:47 +02:00
Readme.md Move samples to repository root 2024-02-02 20:01:14 +02:00
sample-requests.http Move samples to repository root 2024-02-02 20:01:14 +02:00

Dynamic Activity Providers

This sample project demonstrates how to implement a dynamic activity provider.

Overview

The key to providing activities dynamically to the activity registry is to implement the IActivityProvider interface. This interface defines a single method, GetDescriptorsAsync, which returns a list of activity descriptors.

In this example, we are loading API endpoint definitions from a JSON file located in the Data folder and create an activity descriptor for each endpoint. The activity descriptor is then used to create an activity type, which is then registered with the activity registry.

This example could be applied to any other data source, such as a database or a web service, Open API specifications, GraphQL, etc.

Usage

  1. Run the sample project.
  2. Open the workflow editor.
  3. Notice the new activities in the toolbox.
  4. Drag one of the new activities onto the canvas.
  5. Notice the new activity in the canvas.
  6. Run the workflow.
  7. Notice the new activity being executed.

Notes

This project provides sample workflows that you can import into the workflow editor. The workflows are located in the Workflows folder. You can then use the workflow editor to inspect the workflows and see how the activities are used. When imported, you can invoke the workflows using the sample-request.http file located in the root folder containing this project.