In the context of web apps, I'm trying to get my head around how an event sourcing architecture communicates to services. First, I thought of services constantly polling the event store, but then, that might cause performance issues. Now I'm thinking of using notifications (e.g., AWS SNS) instead. Is this a viable/acceptable process? Simplified E.g.,

  1. $orderId = $salesService->placeOrder($orderData)
  2. $salesService->updateEventStore(ORDER_PLACED, $orderData)
  3. AWS SNS notifies $fulfillmentService->getOrderFromEventStore($orderId)
  4. $fulfillmentService->processOrder($orderId)
  5. $fulfillmentService->updateEventStore(ORDER_PROCESSED, $orderId)
  6. AWS SNS notifies $deliveryService->getOrderFromEventStore($orderId)
  7. $deliveryService->shipOrder($orderId)
  8. $deliveryService->updateEventStore(ORDER_DELIVERED, $orderId)

Steps 1-3, 4-6, 7-8 should be atomic.

In the event that 4-6 or 7-8 fails, a "PROCESS_FAILED" event will be saved in the event store. Then a background process will periodically retry failed tasks to an certain extent.

Is this a viable/acceptable process or is there a better way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.