Skip to content

Release v2.10.0

Choose a tag to compare

@github-actions github-actions released this 22 Nov 14:20
63222d6

State machines and workflows now share pluggable actions, defined fluently, and the grains involved can say which grain they are.

Added

  • IAction in Cratis.Choreography.Actions, with ActionContext and ActionResult, as the one thing a state machine or a workflow does.
  • ActionsBuilder, a fluent way to define actions: Call<TService>(service => ...), Call(services => ...), Run(context => ...), RunProcess(...), TransitionTo<TState>(), StartWorkflow(...) and Add(action). The plain actions behind them are CodeAction, ProcessAction, TransitionStateAction, StartWorkflowAction and CompositeAction, which runs several actions in order.
  • Execute<TCommand>(command => ...) on ActionsBuilder executes a Cratis Arc command through ICommandPipeline, and Append<TEvent>(@event => ...) appends a Chronicle event. They come from the new Cratis.Choreography.Arc package and from Cratis.Choreography.Chronicle, so the core package depends on neither.
  • State actions: a State<TStoredState> defines actions with DefineActions(StateActionsBuilder) using OnEntry, WhileRunning and OnExit, or by overriding EntryActions, RunningActions and ExitActions. Reactivating in a state it was already in runs only the running actions, and deactivation runs no exit actions. A failing action throws StateActionFailed.
  • ActionNodePerformer, a base for a workflow node performer that performs its node with actions defined in Define(ActionsBuilder), so the same actions work in workflows.
  • GrainIdentity, GrainKind and IIdentifiable: StateMachine<TStoredState>, WorkflowGrain and WorkflowRunGrain expose their Identity, derived from the Orleans grain id, and every action sees it on its ActionContext. No grain interface changes.
  • The Cratis.Choreography.Arc package.
  • An Actions documentation page, and the packages pages list the new package.