Skip to content

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

@AMLianjun

Description

@AMLianjun

* 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions