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

Consistency between inventory KTable/Topic and state store "reservedStock" for "shipped" event #436

Open
AMLianjun opened this issue Jul 19, 2022 · 1 comment

Comments

@AMLianjun
Copy link

AMLianjun commented Jul 19, 2022

* Currently there is nothing implemented that decrements the reserved items. This

" * Currently there is nothing implemented that decrements the reserved items. This would happen, inside this service, in response to an order being shipped."

Following above comments, "in response to an order being shipped", assume below actions are required:

  • Decrease the reserved count in state store "reservedStock", say iPad
  • Decrease the count of available product (say iPad) in inventory KTable/Topic (Probably publish an event to inventory topic, but there might be latency to refresh to Ktable)

The question: How to ensure two "decreasing" happens in one atomic operation, and not enter into one inconsistent scenario based on these KStream/KTable solution?

  • e.g., if last iPad has been shipped, the count in reserviedStore is decreased to 0, but the "Inventory" is not decreased to 0 in one transaction, one new order may be put as "valid" order by no iPad on-sale actually

So one RDS is required for such cases?

@AMLianjun
Copy link
Author

AMLianjun commented Jul 19, 2022

Maybe some trick existed in KTable if enabled exact-once transaction?
i.e., In transaction context, any new event/messages published to "compacted" topic of KTable, next join/query on KTable will always return the latest values (contain values from this newest event/messages)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant