💔Decoupling Microservices with AWS EventBridge
AWS EventBridge is an architecture changing tool, it will transform the way you think about serverless development. It helps you build event-driven applications at scale across AWS, existing systems or SaaS apps. It shifts you’re thinking on how distributed systems work from a pipeline towards an event-based model.
So what does that mean, shifting from a pipeline towards an event-based model? On an abstract level, it is not that complicated.
You’re probably used to seeing diagrams like these. A couple of microservices hang around and rely on each other. You depend on requests to kick your business logic, and it sort of works. However, the pain comes when you’re rapidly developing, and you’re consumers are no longer able to catch up with you. The backlog is building, and backwards compatibility is now a thing you’re developers are mentioning in their 1–1’s with their managers. At the same time, developers starting to get blocked by the requests they put into the other team’s backlog, and issues are arising. Lastly, there are pains when needing to cancel something in one of the microservices at the last stages of the process. In this example, how about a payment that was returned thus invalidating a review of a product, how would that work? In comes AWS EventBridge.
Event-based microservices are different because they decouple the microservices even further. Instead of relying on something to call on you actively, you’re listening for events in which you’re interested and respond appropriately. This change in methodology creates the possibility for developers to create microservices that truly offer one piece of core functionality based on an event in the process. They are no longer reliant on whatever else is happening around them.
What does AWS EventBridge do then?
EventBridge accommodates this use case by offering a couple of crucial pieces to the puzzle. EventBridge provides an event bus. The event bus is considered the main attraction. It is where you put any newly generated event by any of your clients.
A great feature that EventBridge offers as part of its bus is the routing feature. Thanks to routing, you’re able to very specifically listen to messages instead of all messages on the bus. The last part of the puzzle is consumers’ action based on the messages on the bus. EventBridge offers a set of AWS services as consumers, but there is also support for custom API destinations, allowing you to route a request to an external party directly.
Looking for more information?
The NBTL blog is a platform that contains real life examples of Hello World tutorials and production grade deployments to any of the cloud providers. It helps developers get a grasp on different cloud platforms and their most used services.