Repository navigation
v0.3.0
Pre-releaseFeatures
Activity Options construction
Activity options now require either a start-to-close timeout or a schedule-to-close timeout. In order to make this a compile time requirement, we have changed ActivityOptions construction to a builder pattern.
// If you only need to set a timeout, then we offer constructors
let result = ctx
.start_activity(
MyActivities::process_order,
order_id,
ActivityOptions::start_to_close_timeout(Duration::from_secs(30)),
)
.await?;
// If you need to set additional options, use the `with_` variant get an `ActivityOptionsBuilder`
let start_to_close_opts = ActivityOptions::with_start_to_close_timeout(Duration::from_secs(30))
.heartbeat_timeout(Duration::from_secs(5))
.build();Existing uses of ActivityOptions will need to migrate to use either the new constructors or builder.
Typed Workflow Handles
Workflow handles created from the client can now be typed so signals, queries, and updates are checked against the workflow type:
let handle = client.get_workflow_handle::<MyWorkflow>(workflow_id);
handle.signal(MyWorkflow::some_signal, input, Default::default()).await?;
let value = handle.query(MyWorkflow::some_query, (), Default::default()).await?;
// Or if the workflow type is not available
let handle = client.get_workflow_handle::<UntypedWorkflow>(workflow_id);
let payload = RawValue::from_value(&"input", &PayloadConverter::default());
handle
.signal(UntypedSignal::new("some_signal"), payload, Default::default())
.await?;Typed Child Workflows
Child workflows now preserve argument, signal, and result types:
let name = "Bob".to_string();
let child = ctx
.child_workflow(
GreetingChildWorkflow::run,
name,
ChildWorkflowOptions {
workflow_id: "greeting-child-workflow-id".to_string(),
..Default::default()
},
)
.await?;
child.signal(GreetingChildWorkflow::some_signal, input).await?;
let greeting: String = child.result().await?;Existing child workflow call sites may need to update to the new typed API.
Environment Configuration
The Rust client can now load connection and client options from environment variables and temporal.toml configuration files.
This API is available behind the envconfig feature on temporalio-client, which is enabled by default.
use temporalio_client::{envconfig::LoadClientConfigProfileOptions, Client, ClientOptions, Connection};
let (connection_options, client_options) = ClientOptions::load_from_config(
LoadClientConfigProfileOptions::default(),
)?;
let connection = Connection::connect(connection_options).await?;
let client = Client::new(connection, client_options)?;Learn more about environment configuration in our docs.
Workflow Metadata
The SDK now supports static workflow summaries, static workflow details, and current workflow details. Static metadata can be set when starting workflows or child workflows, and workflows can update current details while running so they are visible through Temporal UI metadata queries.
ctx.set_current_details("waiting for approval");Workflow descriptions are also easier to consume from the client through dedicated accessors on WorkflowExecutionDescription.
let description = handle.describe(Default::default()).await?;
let summary = description.static_summary();
let details = description.static_details();Typed Continue-As-New
Continue-as-new now uses typed workflow inputs, catching Workflow input mistakes at compile time.
ctx.continue_as_new(&new_input, Default::default())?;Workflow Nondeterminism Detection
Workflow futures are now driven by a custom executor. This gives the SDK control over workflow wakers and enables detection of wakes that come from outside SDK-controlled workflow operations that could cause non-determinism in workflows, such as Tokio timers, IO, or spawned threads.
Nondeterministic future detection is enabled by default via WorkerOptions::detect_nondeterministic_futures and can be disabled for tests or advanced use cases.
Samples
The SDK now includes additional samples demonstrating common Rust SDK patterns.
Dependency Cleanup
We continue to trim dependencies and features:
- Updated dependencies and removed unused ones: #1183
- Removed the unused
parking_lotsend guard feature: #1218 - Optimized dependencies: #1219
Bug Fixes
- Provide default empty client config when default user config dir does not exist (#1194)
- Add in scheme port if none present (#1205)
- Make sure legacy queries are failed if gRPC message too large (#1206)
- Normalize how user metadata is encoded (#1216)
- Fix NDE when multiple patches in a single WFT exceed SA's 2048-byte limit (#1225)
- Set WFT Failed cause on grpc message too large incidents (#1229)
- Shutdown rpc initiate shutdown (#1224)
- Update futures are re-polled after workflow state changes: #1153
wait_conditionnow implementsFusedFuture: #1192
New Contributors
- @chndler made their first contribution in #1172
- @eamsden made their first contribution in #1175
- @edo-chan made their first contribution in #1176
- @gibbonjj made their first contribution in #1180
- @GregoryTravis made their first contribution in #1208
Full Changelog: v0.2.0...v0.3.0