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: added content for operations in AsyncAPI Document #2171

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7c6b514
document adding-operations
BhaswatiRoy Sep 26, 2023
4fff5f3
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
d361b7f
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
46f9487
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
c59b9fd
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
26e0044
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
e5d0e60
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
7a9903f
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
2ea6b05
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
f23afda
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
ea07641
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 3, 2023
551940c
updated the adding operations sub section
BhaswatiRoy Oct 30, 2023
9749db3
updated adding operations subsection
BhaswatiRoy Oct 30, 2023
b3643a8
removed unwanted characters
BhaswatiRoy Oct 30, 2023
5b4767e
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 30, 2023
8ab1445
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 30, 2023
dc93f5a
updated the changes including diagrams, and addition of content
BhaswatiRoy Oct 30, 2023
c8ef443
Merge branch 'gsod-work-1' of https://github.com/BhaswatiRoy/website …
BhaswatiRoy Oct 30, 2023
9e7a602
updated changes
BhaswatiRoy Oct 30, 2023
aaf499f
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 31, 2023
61679a6
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Oct 31, 2023
c0da456
removed duplicate lines
BhaswatiRoy Oct 31, 2023
debd164
aligned mermaid diagram code with other writers
BhaswatiRoy Oct 31, 2023
8f5f1da
updated mermaid diagram to align with the style guide
BhaswatiRoy Nov 1, 2023
af6fa6c
added field name details in operations
BhaswatiRoy Nov 1, 2023
511e89a
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Nov 7, 2023
436b618
Update pages/docs/concepts/asyncapi-document/adding-operations.md
BhaswatiRoy Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/docs/concepts/asyncapi-document/_section.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'AsyncAPI Document'
weight: 50
---
113 changes: 113 additions & 0 deletions pages/docs/concepts/asyncapi-document/adding-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
title: Adding Operations
weight: 60
---

In a messaging system, the term "operations" refers to the various methods by which messages are exchanged between participants or components.
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved

## Features

- Operations describe the behaviors and capabilities of the messaging channels described in the AsyncAPI document.

- In a messaging channel, an operation represents a particular action or interaction that can be performed.

- The purpose of these operations is to provide a standardized means for describing the process of publishing, subscribing to, requesting, or replying to messages within the messaging system.
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved

## Adding Operations

For adding operations to an AsyncAPI document, we need to define them within the channels section of the document. You can add operations to an AsyncAPI document as follows -
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved

- Open your AsyncAPI document in a text editor or an AsyncAPI editor tool.

- Locate the `channels` section in your AsyncAPI document. The `channels` section defines the messaging channels and their associated operations.

- Within the `channels` section, add a new channel using the desired channel name. Channels are represented as properties within the `channels` object, and their names are usually formatted as paths or topics, depending on the messaging protocol you are using (e.g. `/users/{userId}/notifications` or `user.notifications`).

- Inside the channel definition, specify the desired operations by creating sub-properties for each operation. Common operations include `publish`, `subscribe`, `publishSubscribe`, `requestReply`, and `request`.

- For each operation, define its details using the appropriate keywords and properties. These details typically include the operation type, payload schema, headers, bindings, and other relevant information.

```mermaid
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved
flowchart TD
style A fill:#E5EE8C,stroke:#333,stroke-width:2px
style B fill:#F3A06A,stroke:#333,stroke-width:2px
style C fill:#CBF399,stroke:#333,stroke-width:2px
style D fill:#F5B5EF,stroke:#333,stroke-width:2px
style E fill:#F568A8,stroke:#333,stroke-width:2px
A(Open AsyncAPI document) --> B(Locate the `channels` section)
B --> C(Add a new channel)
C --> D(Specify operations)
D --> E(Define operation details)
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```

## Types
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved

The operations of the AsyncAPI document are divided into the following categories based on the purpose they serve -

- <b> Publishing: </b> In the publish operation, components are able to send messages to specific channels. This operation allows publishers to publish messages or events for consumption by other components.

```mermaid
flowchart TD
BhaswatiRoy marked this conversation as resolved.
Show resolved Hide resolved
style A fill:#E5EE8C,stroke:#333,stroke-width:2px
style B fill:#CBF399,stroke:#333,stroke-width:2px
style C fill:#F5B5EF,stroke:#333,stroke-width:2px
style D fill:#F568A8,stroke:#333,stroke-width:2px
A[Components] -- Send messages --> B(Publish Operation)
B -- Messages/Events --> C[Specific Channels]
C --> D[Consumption by Other Components]
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```

- <b> Subscribing: </b> By using the subscribe operation, components are able to receive messages from a particular channel. The subscriber can use this operation to indicate whether they are interested in receiving messages from a particular channel.

```mermaid
flowchart TD
style A fill:#E5EE8C,stroke:#333,stroke-width:2px
style B fill:#CBF399,stroke:#333,stroke-width:2px
style C fill:#F5B5EF,stroke:#333,stroke-width:2px
style D fill:#F568A8,stroke:#333,stroke-width:2px
A[Particular Channels] -- Messages --> B(Subscribe Operation)
B --> D[Indicate Interest in Receiving]
D -- Receive messages--> C[Components]
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```

- <b> Request-Reply: </b> Request/Reply establishes a pattern of request-response communication between components. The client can send a request message, and the server will respond with a corresponding reply message. Typically, this operation is used for synchronous communication in which the client anticipates a response from the server.

```mermaid
flowchart TD
style A fill:#E5EE8C,stroke:#333,stroke-width:2px
style B fill:#F5B5EF,stroke:#333,stroke-width:2px
A[Client] -- Request message --> B(Server)
B -- Reply message --> A
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```

- <b> Request: </b> A request operation allows components to submit a request message without requiring a response from the server. This is typically used in situations where the client does not need a direct response from the server, such as fire-and-forget or one-way communication.

```mermaid
flowchart TD
style A fill:#CBF399,stroke:#333,stroke-width:2px
style B fill:#F568A8,stroke:#333,stroke-width:2px
A[Client] -- Request message --> B[Server]
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```

- <b> Publish-Subscribe: </b> With the publishSubscribe operation, messages published to a channel are distributed to multiple subscribers in a publish-subscribe pattern. Messages can be broadcast to a number of consumers interested in a particular topic or event at the same time.

```mermaid
flowchart TD
style A fill:#FFD700,stroke:#333,stroke-width:2px
style B fill:#F3A06A,stroke:#333,stroke-width:2px
style C fill:#3386FF,stroke:#333,stroke-width:2px
A(Publisher) -- Publish messages --> B[Channel]
B -- Messages --> C[Subscribers]
classDef labelStyle color:#000000;
class A,B,C,D,E,F,G,H,I,J labelStyle;
```