REST vs event-driven architecture?

Your thoughts?

|

REST is an architectural approach to communicating between different services. More specifically, it describes how a client / server relationship should work. Through HTTP requests such as GET, POST, PUT, DELETE, RESTful APIs create a request/response relationship between clients and servers.

Event driven architecture revolves around asynchronous messages being sent across services. Leveraging frameworks like Kafka or MQ, event driven architecture allows for high volumes of messages to be produced and consumed in a fault tolerant way that scales.

RESTful APIs make sense when you want to wait for a formatted response in a synchronous fashion. The most popular example of this is authentication where you want to know if a user is authenticated and authorized to access a given resource. This would not work well with an event driven approach...

Event driven architecture makes sense when you want to deliver a high volume of messages in a fault tolerant way. Think Netflix or Uber. These applications require millions of events to be produced and consumed to arrive at their wholistic solution.

|

Event driven architecture is the new craze. Actually it's not that new. Ever since applications started demanding highly scalable, fault tolerant communication with large volumes of "events" or "messages" or "state changes", event driven architecture (revolving around microservice based approach) has been all the rage in the world of software development.

|

REST = sync

Event Driven = async

|

Both have pros and cons. We use REST a lot for synchronous activity and event based approach for more async activity.

Realistically one is not better than the other. Typically a combination of both is used to design a complete solution.

|

use REST if you run a blog. Use event driven if you run a platform.

|

I heard that event driven approach is best in 2022 at least...