Skip to content

Commit

Permalink
Extra warnings about the saga identity tracking between messages. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Oct 10, 2024
1 parent 9d3fea8 commit 58bcae4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/guide/durability/sagas.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ public class CompleteOrderHandler1228388417 : MessageHandler

## Saga Message Identity

::: warning
The automatic saga id tracking on messaging **only** works when the saga already exists and you are handling
a message to an existing saga. In the case of creating a new `Saga` and needing to publish outgoing messages related
to that `Saga` in the same logical transaction, you will have to embed the new `Saga` identity into the outgoing message bodies.
:::

In the case of two Wolverine applications sending messages between themselves, or a single Wolverine
application messaging itself in regards to an existing ongoing saga, Wolverine will quietly track
the saga id through headers. In most other cases, you will need to expose the saga identity
Expand Down Expand Up @@ -301,6 +307,12 @@ public static (Order, OrderTimeout) Start(StartOrder order, ILogger<Order> logge
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/OrderSagaSample/OrderSaga.cs#L24-L36' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_starting_a_saga_inside_a_handler' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

::: warning
The automatic saga id tracking on messaging **only** works when the saga already exists and you are handling
a message to an existing saga. In the case of creating a new `Saga` and needing to publish outgoing messages related
to that `Saga` in the same logical transaction, you will have to embed the new `Saga` identity into the outgoing message bodies.
:::

You can also simply return one or more `Saga` type objects from a handler method as shown below where `Reservation` is a Wolverine saga:

<!-- snippet: sample_reservation_saga -->
Expand Down

0 comments on commit 58bcae4

Please sign in to comment.