-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
activityThis issue relates to a workflows activityThis issue relates to a workflows activitycoreThis issue relates to the core libraryThis issue relates to the core library
Description
Description
An activity type provider that uses a given (set of) protobuf file(s) containing service definitions would allow users to orchestrate actors by using these activities in a workflow.
Example
For example, take the following virtual actor definitions:
syntax = "proto3";
service ThermostatGrain {
rpc Read () returns (Temperature);
rpc Update (Temperature) returns (Empty);
}
service FireplaceGrain {
rpc Start () returns (Empty);
rpc Stop () returns (Empty);
}
The activity type provider would automatically yield the following activities using appropriate conventions:
- Read Thermostat
- Update Thermostat
- Start Fireplace
- Stop Fireplace
Using these activities, one could write the following workflow that keeps the room at a comfortable temperature:
class ComfyRoomWorkflow : IWorkflow
{
public void Build(IWorkflowDefinitionBuilder workflow)
{
var temperatureVariable = new Variable<Temperature>();
const desiredTemperature = new Temperature(21);
workflow.WithRoot(new Sequence
{
Variables = { temperatureVariable }
Activities =
{
// Every 5 minutes.
Timer.FromMinutes(5),
// Read the current temperature into a variable.
new ReadThermostat(temperatureVariable ),
// If the current temprerature drops below a certain threshold:
new If(context => temperatureVariable.Get(context) < desiredTemperature)
{
// Then heat things up a little.
Then = new StartFireplace(),
// Else, stop the fire place. May want to check its current state first, but leaving that out for simplicity.
Else = new StopFireplace()
}
}
})
}
}
mohdali and GhalamborM
Metadata
Metadata
Assignees
Labels
activityThis issue relates to a workflows activityThis issue relates to a workflows activitycoreThis issue relates to the core libraryThis issue relates to the core library
Type
Projects
Status
Todo