Messages vs Commands vs Events | Event-Driven Architecture 101

By | December 15, 2020

Unsure what the difference is between event-driven, message-driven or request-driven communication patterns are then read this linked article first. (Link opens in new tab)

What is an event, in event-driven architecture?

Note: This post was originally posted as a YouTube video which you can watch here

And to answer that we need to drive into the two types of triggers in event-driven architecture.

So, An event can be a command, or it can be an event

You might be asking what the difference is

Well, a command, is what you want to be done. It is a ORDER, its a REQUEST; it is a TRIGGER which triggers a process to do an action. 

Whereas an EVENT is what has happened in the past. It is the RESPONSE; it is an OUTCOME, which triggers Subscribers,to perform actions when certain citreas have been met. 

Let?s take a simple example around, around an dog owner wanting to register his dog at a vets using an online website. an owner registering a dog at a vets using a web application. 

Now, In the example, I will use the term TOPIC, which is a term from Apache Kafka, which is one of the many platforms which can be used in event-driven architecture., where queues, channels, streams are called Topics. 

I prefer the general term topic because a topic can be a queue; it can be a log; it can be an event stream. 

Thanks, now back to to the main example

In this example, we have a client, an application, where an owner would register their dog. 

After the owner has completed the form and clicked register on the application, the client would publish the message ? to a Request topic. 

This topic is in turn consumed, subscribed by another service, which will process the request.

Once the processor has completed processing successfully, it can publish the outcome event, what has happened. 

This event can then be consumed by any process which needs to act when the event happens. 

Now Hopefully I have been able to explain how you would be able to use an event in event-driven architecture.

Leave a Reply