danielgmyers / flux-swf-client

Apache License 2.0
10 stars 3 forks source link

Support targeting signals more cleanly #104

Open danielgmyers opened 2 years ago

danielgmyers commented 2 years ago

Today, signals must be targeted by activity id, which require users to construct the raw activity ID string the same way Flux does it internally. While this is not complicated, it does make it more difficult for Flux to adjust its naming strategy in the future.

Instead, Flux should support accepting three separate fields in the signal input, instead of activityId.

For example, today a DelayRetry signal's content would be this:

{
  "activityId": "EatSandwich_5_grape",
  "delayInSeconds": 543
}

Instead, we could accept this input:

{
  "stepName": "EatSandwich",
  "attemptNumber": 5,
  "partitionId": "grape",
  "delayInSeconds": 543
}

The partitionId field would be ignored for non-partitioned steps.

It might be feasible to drop the attemptNumber input entirely; we could instead determine the applicable attempt number by comparing the event order of the various ActivityTaskFailed and WorkflowExecutionSignaled events.

danielgmyers commented 5 months ago

Also need to update https://github.com/danielgmyers/flux-swf-client/blob/main-2.1.0/SIGNALS.md