dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.12k stars 340 forks source link

Starting a workflow at different app #1333

Open ozgurgunseli opened 4 months ago

ozgurgunseli commented 4 months ago

Hi there,

Currently, we can start a workflow using DaprClient. However, when we need to start a workflow that is registered in a different Dapr application, the current client does not allow us to initiate it.

Scenario:

In this scenario, when an API call is made to App 2, it should start the "GenerateLog" workflow in App 1. While we can achieve this by directly calling the Dapr URL for server-app, the current StartWorkflowAsync method of DaprClient does not allow us to specify an app-id.

Given the need for a client-server architecture in our applications, adding this feature would be highly beneficial.

Thank you!

WhitWaldo commented 3 months ago

An overload could be added to the DaprClient that added a dapr-id argument and which registered some sort of endpoint to listen for such calls to the target application, but in the short term, why not just implement that yourself?

1) In App 2, create an endpoint with the logic to start some workflow with provided arguments 2) In App 1, use the DaprClient to utilize the service invocation functionality to all this endpoint and pass it the necessary arguments. 3) App 2 starts the target workflow locally as desired.

At the end of it, sure, I can see this being a helpful sort of thing done for you as part of the client initialization, but there's also nothing the client would do that you can't already trivially do yourself with the few steps above.