-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Feature Request
Problem
Currently, to send an external event from one orchestration to another, users need to:
- Create a custom activity that wraps
client.raise_event() - Register this activity in the activity registry
- Schedule the activity from the orchestration
This boilerplate is error-prone and adds unnecessary complexity.
Current Workaround
// send_external_event.rs - Custom activity
pub async fn activity(
ctx: ActivityContext,
input: SendExternalEventInput,
) -> Result<SendExternalEventOutput, String> {
let client = ctx.get_client();
client
.raise_event(&input.instance_id, &input.event_name, &input.payload)
.await
.map(|_| SendExternalEventOutput { sent: true })
.map_err(|e| e.to_string())
}Proposed Solution
Add raise_event as a first-class method on OrchestrationContext:
// In orchestration code
ctx.raise_external_event(
&target_instance_id,
"InstanceDeleted",
&payload
).await?;This would:
- Eliminate the need for a custom activity
- Be consistent with other system operations like
schedule_timer - Properly integrate with duroxide's event sourcing/replay semantics
Use Case
In Toygres, when deleting an instance, we need to signal the instance's health monitoring actor to gracefully shut down before cleaning up K8s resources:
// delete_instance.rs orchestration
// Signal the actor to stop health checks and exit
ctx.raise_external_event(
&instance_actor_orchestration_id,
"InstanceDeleted",
"{}"
).await;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels