elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.25k stars 1.14k forks source link

Allow signaling of custom activities #1053

Open sfmskywalker opened 3 years ago

sfmskywalker commented 3 years ago

This idea originates from a conversation I had with TedDBarr on Discord.

Currently, the /signals/trigger endpoint that is invoked by generated signal token URLs only triggers the SignalReceived activity,

But if we include the activity type from where one generates the token (e.g. WitingOnTaskCompletion in below sample custom activity) then the endpoint that the URL points to can read the activity type and trigger that one instead of SignalReceived.

Which is great, because it simplifies implementing custom "signal" activities such as your example tremendously!

public class WaitingOnTaskCompletion :  Activity
{
    protected override IActivityExecutionResult OnExecute(ActivityExecutionContext context)
    {
        var signalUrl = context.GenerateSignalUrl("Done");

        return Suspend();
    }
}
promontis commented 1 year ago

@sfmskywalker what is the state of this?

sfmskywalker commented 1 year ago

Still in the TODO state.