Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Outbox docs #3763

Merged
merged 28 commits into from
Oct 3, 2023
Merged

Add Outbox docs #3763

merged 28 commits into from
Oct 3, 2023

Conversation

yaron2
Copy link
Member

@yaron2 yaron2 commented Sep 25, 2023

Add documentation for the outbox feature.

Closes #3733.

Signed-off-by: yaron2 <[email protected]>
@yaron2 yaron2 requested review from a team as code owners September 25, 2023 16:00
Copy link
Member

@msfussell msfussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my review and provided updates


The transactional outbox pattern is a well known powerful design pattern for sending notifications about a change in a system's state using a single transaction that spans across the database and message broker used to deliver the notification. Developers are faced with many difficult technical challanges when trying to implement this pattern on their own, which often involves writing error-prone central coordination managers that end up supporting a combination of one or two databases and message brokers at most.

With Dapr's outbox support, developers can notify subscribers when a system's state is created or updated when calling Dapr's [transactions API]({{< ref "state_api.md#state-transactions" >}}).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
With Dapr's outbox support, developers can notify subscribers when a system's state is created or updated when calling Dapr's [transactions API]({{< ref "state_api.md#state-transactions" >}}).
With Dapr's outbox support, you can notify subscribers when an application's state is created, updated or deleted when calling Dapr's [transactions API]({{< ref "state_api.md#state-transactions" >}}).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the text below....


The diagram below is an overview of how the outbox pattern works:
1) Service A saves/updates state to the state store using a transaction.
2) A message is written to the broker under the same transaction. When the message is successfully delivered to the message broker the transaction completes ensuring the state and message are transacted together.
3) The message broker delivers the message topic to any subscribers, in this case Service B.

<img src="/images/state-management-outbox.png" width=800 alt="Diagram showing the steps of the outbox pattern">

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will send you a PNG file to include into this PR and check into the static/images folder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested change is incorrect, outbox is about notifying when data has been created or inserted, not deleted.


### Combining outbox and non-outbox messages on the same state store

If you want to use the same state store for sending both outbox and non-outbox messages, simply define two state store components, where one has the outbox feature and the other does not.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you want to use the same state store for sending both outbox and non-outbox messages, simply define two state store components, where one has the outbox feature and the other does not.
If you want to use the same state store for sending both outbox and non-outbox messages, simply define two state store components that connect to the same state store, where one has the outbox feature and the other does not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions

  1. Is it better to use MySQL as an example here than Redis, given that Redis is not a "True" transactional state store
  2. If I do use Redis, could I use the same Redis instance for both the state store and the message broker? Is so, then I would mention this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I switched to MySQL as its a better example.

yaron2 and others added 16 commits September 25, 2023 21:55
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
Signed-off-by: yaron2 <[email protected]>
Signed-off-by: yaron2 <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Mark Fussell <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
Signed-off-by: yaron2 <[email protected]>
Signed-off-by: yaron2 <[email protected]>
@yaron2
Copy link
Member Author

yaron2 commented Sep 26, 2023

@msfussell all feedback has been addressed

@yaron2 yaron2 changed the title add Outbox docs Add Outbox docs Sep 26, 2023
@msfussell
Copy link
Member

@hhunter-ms - LGTM. Any feedback on this?

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Stale PR, paging all reviewers

@github-actions github-actions bot added the stale label Oct 3, 2023
Copy link
Collaborator

@hhunter-ms hhunter-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick grammar review

yaron2 and others added 8 commits October 3, 2023 09:39
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
…ate-management/howto-outbox.md

Co-authored-by: Hannah Hunter <[email protected]>
Signed-off-by: Yaron Schneider <[email protected]>
@yaron2
Copy link
Member Author

yaron2 commented Oct 3, 2023

quick grammar review

@hhunter-ms changes made.

Copy link
Member

@msfussell msfussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaron2 yaron2 dismissed hhunter-ms’s stale review October 3, 2023 17:02

Changes addressed

@yaron2 yaron2 merged commit 116e50b into dapr:v1.12 Oct 3, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants