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

feat: order system example #458

Merged
merged 4 commits into from
Sep 18, 2024
Merged

feat: order system example #458

merged 4 commits into from
Sep 18, 2024

Conversation

malandis
Copy link
Contributor

@malandis malandis commented Sep 13, 2024

Adds an example demonstrating how a restaurant could use caching and
topics to store order status and communicate with wait staff.

Example output:

2024-09-13 15:25:47,965 INFO     momentosdk Creating cache with name: cache
2024-09-13 15:25:48,226 INFO     order-system-example Using existing cache.
2024-09-13 15:25:48,481 INFO     order-system-example Waiter subscribed to order updates.
2024-09-13 15:25:49,227 INFO     order-system-example The waiter is ready to update customers.
2024-09-13 15:25:49,227 INFO     order-system-example Kitchen updating order 1 with status: Preparing
2024-09-13 15:25:49,488 INFO     order-system-example Updated order status: Order 1: Preparing
2024-09-13 15:25:49,752 INFO     order-system-example Waiter received order update: Order 1: Preparing
2024-09-13 15:25:49,752 INFO     order-system-example Waiter notifies customer: Order 1: Preparing
2024-09-13 15:25:49,752 INFO     order-system-example Published order status: Order 1: Preparing
2024-09-13 15:25:51,753 INFO     order-system-example Kitchen updating order 1 with status: Ready to Serve
2024-09-13 15:25:51,809 INFO     order-system-example Updated order status: Order 1: Ready to Serve
2024-09-13 15:25:51,858 INFO     order-system-example Published order status: Order 1: Ready to Serve
2024-09-13 15:25:51,863 INFO     order-system-example Waiter received order update: Order 1: Ready to Serve
2024-09-13 15:25:51,863 INFO     order-system-example Waiter notifies customer: Order 1: Ready to Serve
2024-09-13 15:25:56,859 INFO     order-system-example The waiter has served the order.
2024-09-13 15:25:56,861 INFO     order-system-example Waiter task cancelled successfully.

Adds an example demonstrating how a restaurant could use caching and
topics to store order status and communicate with wait staff.
@malandis malandis requested review from poppoerika and a team September 13, 2024 22:35
@poppoerika
Copy link
Contributor

@malandis thank you for the example!
And as @cprice404 mentioned, they are thinking more like a decorator type of thing for the set api that calls publish under the hood since they will be calling subscribe from iPads via our Web SDK.

Adds a wrapper class with a new method `set_and_publish` that performs
a serial set and publish. Refactors the example to use it, which moves
the set and publish logic out of the kitchen and into this new class.
@poppoerika poppoerika self-requested a review September 17, 2024 23:54
Copy link
Contributor

@poppoerika poppoerika left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you. 🚀

@malandis malandis merged commit 01fb509 into main Sep 18, 2024
10 checks passed
@malandis malandis deleted the feat/topic-client-example branch September 18, 2024 18:38
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

Successfully merging this pull request may close these issues.

2 participants