Skip to content

Instantly share code, notes, and snippets.

@gterzian
Created May 11, 2020 04:58
Show Gist options
  • Save gterzian/19d18f9b628d7bbaf1ece81e7e4a0766 to your computer and use it in GitHub Desktop.
Save gterzian/19d18f9b628d7bbaf1ece81e7e4a0766 to your computer and use it in GitHub Desktop.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
struct CustomerId(Uuid);
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
struct OrderId(Uuid);
/// Messages sent from the "basket" service,
/// to the "order" service.
enum OrderRequest {
/// A customer is attempting to make a new order.
NewOrder(CustomerId),
/// We're shutting down.
ShutDown,
}
/// The result of making a new order,
/// sent by the "order" service, to the "basket" service.
struct OrderResult(CustomerId, bool);
/// Messages sent from the "order" service,
/// to the "payment" service.
enum PaymentRequest {
/// Attempt a payment for an order.
NewOrder(OrderId),
/// We're shutting down.
ShutDown,
}
/// The result of making a new payment,
/// sent by the "payment" service, to the "order" service.
struct PaymentResult(OrderId, bool);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment