Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: content for module 2 #7

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
51 changes: 51 additions & 0 deletions 100-level-AsyncAPI-Intro/step1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Eve assumes her problem-solving role and approaches the spaceship. Inside, Eve discovers Chan, a programming genius visiting from Brownieterra. It becomes apparent that a technical glitch has affected the ship's communication system.

With her expertise in event-driven architecture (EDA) and AsyncAPI, Eve swiftly springs into action. She formulates a plan to establish seamless communication among the spaceship's components in collaboration with Chan.

Eve begins by providing Chan with a comprehensive explanation of event-driven architecture (EDA) and outlines the process of designing an EDA system using AsyncAPI.

## Event-driven architecture

An event signifies a change in the system's state that triggers communication between different services. Event-driven architecture (EDA) decomposes an application into several components interacting via events. These components encompass event producers and consumers:

- An event **producer** identifies an event and sends relevant information through the event channel.
- An event **consumer** subscribes to an event channel to receive and process event data.

Each component can fulfill the role of an event producer, consumer, or both.

As Eve continues her conversation with Chan, she realizes she hasn't yet offered him a beverage. She decides to make a cup of coffee and uses the concept of a coffee shop as an analogy for asynchronous communication:

1. A customer (producer) orders an espresso (event) and pays for it, akin to sending a message in an asynchronous system.
1. After paying, the customer moves to a separate area, such as a table or the waiting zone, freeing up the queue. This separation of order placement and fulfillment zones mirrors the decoupling in asynchronous transactions.
1. The barista (consumer) processes the order and, once the espresso is prepared, delivers it to the customer at their table or calls the customer by name to collect it from the counter. This step signifies the completion of the asynchronous process, where the response (the prepared coffee) is received without the customer actively waiting at the counter.

In this coffee shop scenario, event-driven architecture mirrors the seamless flow of orders and drinks without any disruption, ensuring a smooth and efficient operation.
Chan asks Eve how the AsyncAPI specification impacts the event-driven architecture world.

## Event-driven architecture with AsyncAPI

AsyncAPI simplifies defining communication and message exchange among different components in an Event-Driven Architecture (EDA). It structures the description of events, channels, and message formats, enhancing overall understanding. Essentially, AsyncAPI serves as a contract, formalizing agreements between system components on message structure, event communication, and channel usage.

AsyncAPI helps you define asynchronous APIs. Asynchronous APIs are like digital mailboxes where you can send messages without waiting for an instant reply. When the other person reads your letter and has something to say, they will reply. AsyncAPI maps out events, their communication channels, and the responses in an EDA.

Chan spots cake in Eve's kitchen and asks for a slice as she likes cakes. While offering her a slice, Eve gives an example: imagine a birthday party with events like cake cutting and gift opening. These events trigger responses, such as singing during the cake-cutting or clapping while opening the gifts.

AsyncAPI helps organize events, for example, during the cake cutting, AsyncAPI guides in singing the birthday song. It also enables the creation of a party schedule, like cutting the cake at 6 pm and opening gifts at 7 pm.

Here are reasons why using AsyncAPI enhances EDA design:

* AsyncAPI plans and describes each event and its corresponding reactions across different components.
kakabisht marked this conversation as resolved.
Show resolved Hide resolved
* AsyncAPI facilitates communication between different components for seamless information exchange.
* AsyncAPI allows components to complete tasks independently without waiting.
Comment on lines +38 to +39
Copy link
Member

@smoya smoya Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not really allowing that IMHO. At most it allows to set a contract between senders and receivers and can help with its auth policies, etc. Remotely it lowers the entry barrier by generating some code.

In general, those 3 points are not really explaining why you should use AsyncAPI for you EDAs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you suggest me some points that better describe why to use AsyncAPI for EDAs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would DM sergio directly for this question too @kakabisht 😸, it looks like a short convo might clarify this item.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did ping sergio :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Did you get clarification on what to update? How was this resolved? :)


Eve goes on to show Chan how AsyncAPI can enhance communication between microservices.

## Microservices with AsyncAPI

In a microservices architecture, each microservice represents a specific function. Different microservices communicate using events, similar to how teams collaborate on tasks. For example, one team handles baking the birthday cake, while another focuses on decorating the room. These teams must communicate to share their progress.

AsyncAPI helps different microservices communicate with each other. For microservices to talk to each other, they would have to define how to send and receive messages.

AsyncAPI ensures that each microservice knows what information it will receive and how it will receive it. AsyncAPI helps document interactions between microservices for developers developer understanding and integration.

Now, with coffee in hand, Eve and Chan are ready to step into Chan's spaceship to enhance its communication system.
Loading