Statifier.Actions.InvokeAction (statifier v1.9.0)
View SourceRepresents and executes SCXML <invoke> elements for external service communication.
The <invoke> element is used to create an instance of an external service
and establish a communication channel with it. This is the standard SCXML
mechanism for side effects and external system integration.
Attributes
type- The type of external service to invoke (e.g., "elixir", "http")src- The source/location of the service to invokeid- Optional unique identifier for the invocationparams- List of parameters to pass to the invoked servicesource_location- Source code location for error reporting
Supported Invoke Types
"elixir"- Invokes Elixir modules and functions directly"http"- Makes HTTP requests to external services (future)"genserver"- Communicates with GenServer processes (future)
Summary
Functions
Dispatches the service invocation using registered handlers.
Evaluates parameter expressions and builds the parameter map for service invocation.
Executes an invoke element within the given state chart context.
Creates a new InvokeAction element.
Types
@type t() :: %Statifier.Actions.InvokeAction{ id: String.t() | nil, params: [Statifier.Actions.Param.t()], source_location: map() | nil, src: String.t() | nil, type: String.t() | nil }
Functions
@spec dispatch_invoke(t(), map(), Statifier.StateChart.t()) :: {:ok, Statifier.StateChart.t()}
Dispatches the service invocation using registered handlers.
This is the secure approach where only registered handlers can be invoked, preventing arbitrary function execution while maintaining SCXML compliance.
@spec evaluate_params([Statifier.Actions.Param.t()], Statifier.StateChart.t()) :: {:ok, map(), Statifier.StateChart.t()} | {:error, term()}
Evaluates parameter expressions and builds the parameter map for service invocation.
@spec execute(t(), Statifier.StateChart.t()) :: {:ok, Statifier.StateChart.t()} | {:error, term()}
Executes an invoke element within the given state chart context.
Parameters
invoke- The InvokeAction element to executestate_chart- Current StateChart with context and data model
Returns
{:ok, updated_state_chart} or {:error, reason}
Creates a new InvokeAction element.
Examples
iex> Statifier.Actions.InvokeAction.new(type: "elixir", src: "NotificationService.send_email")
%Statifier.Actions.InvokeAction{type: "elixir", src: "NotificationService.send_email", params: []}