SAService Architect Open designer
SAService ArchitectDocumentation
Framework reference pub async fn make_<name>(context: MessageContext, environment: RuntimeEnvironment) -> RuntimeResult<<Name>>

Rust Extension model

Rust services use `servicelib` crate from `rustservicelib`. Generated graph assembly owns runtime wiring; application code supplies typed business implementations through preserved maker functions.

When to use

Use this page while implementing a generated business function or endpoint handler.

Behavior

  • The runtime is Tokio with async traits and shared immutable payloads.
  • The generated service imports the user-owned module and calls its maker once during graph assembly. Implement the generated trait for the returned type.
  • Business-function makers receive context and environment and create one instance per service, shared by all referencing streams. Only infrastructure makers additionally receive their typed configuration. Endpoint-handler makers follow the same context-and-environment contract as other business functions.
  • Returning a construction error stops service startup instead of leaving a partially wired graph.

Regeneration contract

Function and endpoint implementation files are preserved by the merge script. Generated registries and graph assembly may change around them; make merge-validate detects a preserved maker whose generated signature is no longer compatible.

Choosing where state lives

Keep reusable clients and immutable dependencies on the implementation object. Keep request, record, RPC, or workflow invocation data in handler state. Use the runtime context for cancellation and correlation instead of inventing a parallel context channel.

Generated and user-owned boundaries

How generated services discover and run application code.

Type or methodRoleDescription
Generated graph assemblyFramework owned

Creates streams, links, connectors, endpoint consumers, serializers, stores, and runtime pools from the designer graph.

Maker functionUser entry point

pub async fn make_<name>(context: MessageContext, environment: RuntimeEnvironment) -> RuntimeResult<<Name>>

Implementation objectUser owned

Contains business dependencies and reusable state for one generated function or endpoint.

Typed configGenerated contract

Matches the selected graph node and exposes its runtime configuration to the maker.

Service environmentFramework dependency

Provides configured observability and runtime services without requiring global variables.

Generated extension pattern

pub fn make_validate_order(
    context: MessageContext, environment: RuntimeEnvironment,
) -> RuntimeResult<ValidateOrder> {
    Ok(ValidateOrder::default())
}