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: add new consumer concept doc #991

Merged
merged 14 commits into from
Oct 25, 2022
28 changes: 28 additions & 0 deletions pages/docs/concepts/consumer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Consumer
weight: 4
---

## What is a Consumer?
In an Event Driven Architecture (EDA), a consumer is a component of an application or messaging system that listens for a particular event from a broker and takes the necessary action in response.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In an Event Driven Architecture (EDA), a consumer is a component of an application or messaging system that listens for a particular event from a broker and takes the necessary action in response.
In an Event Driven Architecture (EDA), a consumer is an application that listens for a particular event from a broker and reacts to it.

application

I think it is good to be consistent with producer document that was just released

takes the necessary action in response

I would avoid response as it is known term in request/response pattern, and might be suggest consumer sends a response


## What is the purpose of Consumers?
Unlike traditional RestAPIs, EDA creates a setting where there is never a wait for requests or responses to an event. In this pattern, a consumer is unaware of the producer or other consumers; all they know is that when a broker sends them an event they are subscribed to, they receive it.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Unlike traditional RestAPIs, EDA creates a setting where there is never a wait for requests or responses to an event. In this pattern, a consumer is unaware of the producer or other consumers; all they know is that when a broker sends them an event they are subscribed to, they receive it.
Unlike traditional REST APIs, in EDA, consumers of the event are not expected to respond immediately on the same connection. In this architecture, a consumer is unaware of the producer or other consumers; all they know is that when a broker sends them an event, it is because they subscribed to it.

how about this? just to clarify about communication that it is not on sync, because sometimes people do request/response in EDA, but it is still async. Like in DM on Slack, you send question, you do not know who will answer, but you definitely expect that in a thread at some point of time someone will send a response. Makes sense

you can freely adjust the paragraph, my suggestions are just to "visualize" what I mean


When you want events processed asynchronously in your application, the consumer plays an important role in completing that flow of event data in the event channel.

```mermaid
flowchart LR
a[Producer] -- Event A --->c[(Broker)]
a -- Event B ---> c
c -- Event A ---> d[Consumer A]
c -- Event A ---> e[Consumer B]
c -- Event B ---> e[Consumer B]
c -- Event B ---> f[Consumer C]
subgraph Consumers
d
e
f
end
```
The diagram above depicts an example of the flow of events from a producer to a broker and then to the consumers. In this instance, the producer publishes two events, A & B and sends to the broker. Then each consumer receives events from what it is subscribed to.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The diagram above depicts an example of the flow of events from a producer to a broker and then to the consumers. In this instance, the producer publishes two events, A & B and sends to the broker. Then each consumer receives events from what it is subscribed to.
The diagram above depicts an example of the flow of events from a producer to a broker and then to the consumers. In this instance, the producer publishes two events, A & B, and sends them to the broker. Then each consumer receives events that they are subscribed to.