Skip to content

Commit

Permalink
Elaborate a bit on the meaning of idempotency (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein authored Jan 24, 2022
1 parent 20d8cb3 commit 578498b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/saga_action_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,18 @@ pub trait Action<UserType: SagaType>: Debug + Send + Sync {
/**
* Executes the action for this saga node, whatever that is. Actions
* function like requests in distributed sagas: critically, they must be
* idempotent. They should be very careful in using interfaces outside of
* idempotent. This means that multiple calls to the action have the
* same result on the system as a single call, although the action is not
* necessarily required to return the same result.
*
* As an example, generating a UUID to represent an object is a common saga
* action: if called repeatedly, it may generate different results, but it
* has no side effects on the rest of the system. Similarly, using a
* generated UUID in a subsequent action to create an object may help ensure
* that the side effects appear the same, regardless of how many times the
* action has been invoked.
*
* Actions should be very careful in using interfaces outside of
* [`ActionContext`] -- we want them to be as self-contained as possible to
* ensure idempotence and to minimize versioning issues.
*
Expand Down

0 comments on commit 578498b

Please sign in to comment.