The combination of cloud, serverless and microservices has taken the service implementation to a different level. Though this has accelerated the monolith to microservices transformation, it has also introduced new complexities around service-to-service communication. With every new service added to the system, the order of communications complexity also increases.
Though AWS services such as SNS, SQS and others helped to some extend, they however failed to offer a flexible way to enable filtered routing of messages between microservices. This is where Amazon’s EventBridge makes its mark in alleviating many of these concerns.
AWS EventBridge promotes a hub-and-spoke communication model between microservices. With its flexible and powerful message filtering capability, services can have a renewed way of performing event-driven communication between them. This talk will start by explaining EventBridge and then, with the help of real use-case scenarios, explain how to enable message routing and filtering while working with the event bus.
23. Event Filtering
Event Routing Rules
Filtering is like trapping the events of interest for
processing needs or requirements
Routing rules are for shaping the (trapped) events
and sending them to consuming targets
27. Event Routing
• Pass-through event routing
• Entire event data is passed
• Part of the event data routed
• Expose just the required data
• Static data is routed
• Original event not exposed
• Transform to a new event
• Extract the needed data
35. Pattern – Hub-and-spoke event bus
Customer
login
Login Shipping
Send order
to SAP
Data sync
Customer, VIP,
wishlist sync
Checkout
Submit
order
Payment
Authorize
payment
Commerce
platform
Order
Process
order
Order and
customer
updates
Event
relay
Customer
login
Invoke
every
minute
Events Order
complete
Customer
login
Payment
authorized
Order
submit
Order
complete
EventBridge
FIFO
queue
82. AWSServiceEvents
Schema of all
services on
EventBridge
Preloaded and
ready for use
CustomCreatedEvents
Create schema
Upload schemas
Generate schema
from JSON data
AutoGeneratedEvents
Auto generated
Captured from the
actual event
Enable at the
event bus level
84. AWSServiceEvents
Schema of all
services on
EventBridge
Preloaded and
ready for use
CustomCreatedEvents
Create schema
Upload schemas
Generate schema
from JSON data
AutoGeneratedEvents
Auto generated
Captured from the
actual event
Enable at the
event bus level
86. AWSServiceEvents
Schema of all
services on
EventBridge
Preloaded and
ready for use
CustomCreatedEvents
Create schema
Upload schemas
Generate schema
from JSON data
AutoGeneratedEvents
Auto generated
Captured from the
actual event
Enable at the
event bus level
88. • Use one custom schema registry per event bus
• com.LEGO.ecom.schema.registry
• Payment Service Schema Registry
• Follow a naming convention for schema
• com.LEGO.ecom.checkout.OrderComplete
• com.LEGO.ecom.email.RegistrationRequest
• [org].[domain].[microservice].[EventName]
92. • Use EventBridge for microservices communications
• Use SNS for internal service communications
• Try and follow a defined structure for custom events
• Implement finer controlled event flow
• Limit event data exposure beyond the service bus
• Events are state changes and action notifiers; not log statements
• Implement the targets as idempotent where applicable
94. • At least once event delivery with 24 hour retry
• Events with no subscriber are dropped / lost
• No support for DLQ setup at event subscription
• Cannot route events to an event bus in the same account
• Events should be of defined JSON structure format
• Latency is roughly around 0.5 seconds
• Throughput is lower than SNS
• SaaS partners can be of event source; not targets
96. • Use EventBridge for microservices communication
• Have a defined custom event structure
• Control the event exposure to downstream targets
• Incrementally migrate to use EventBridge
• Explore the partner SaaS event sharing option
• Event bus is for events and not for logs!