Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit b3755ee

Browse files
author
Anton Vorontsov
committed
Finished delayed message section documentation.
1 parent 46d87a3 commit b3755ee

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

RabbitMQ.Client.Core.DependencyInjection.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ EndProject
2626
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{BC4CDBDE-4AEE-44B3-B00B-380EB1AC5E62}"
2727
ProjectSection(SolutionItems) = preProject
2828
docs\changelog.md = docs\changelog.md
29-
docs\documentation.md = docs\documentation.md
3029
docs\rabbit-configuration.md = docs\rabbit-configuration.md
3130
docs\exchange-configuration.md = docs\exchange-configuration.md
3231
docs\message-production.md = docs\message-production.md
3332
docs\message-consumption.md = docs\message-consumption.md
33+
docs\readme.md = docs\readme.md
3434
EndProjectSection
3535
EndProject
3636
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "images", "images", "{93D59B0E-856C-4260-B50E-57FE5C0F5073}"

docs/message-consumption.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,7 @@ So you can use async/await power inside your message handler.
286286

287287
### Workflow of message handling
288288

289+
290+
291+
289292
For message production features see the [Previous page](message-production.md)

docs/message-production.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,24 @@ await queueService.SendAsync(bytes, properties, exchangeName: "exchange.name", r
107107
```
108108

109109
### Mechanism of sending delayed messages
110-
110+
The implementation of sending deferred (delayed) messages in this project is quite tricky.
111+
The image below shows a model of the whole process of passing the message from the producer to the consumer.
111112
![Model of sending delayed messages](./images/delayed-message-model.png)
112113

114+
**Prerequisites.** Let's say that producer want to send a message to the exchange **"Exchange B"** with a routing key **"routing.key"** and delay in **30 seconds**.
115+
- Message goes to the exchange **"Exchange A"** whose responsibility is to manage delaying (storing) the message.
116+
- After that a queue with a compound name and special arguments is being created. Name consists of three parts: routing key of sent message, word "delayed" and number of seconds delay.
117+
Queue arguments are as follows.
118+
```
119+
x-dead-letter-exchange : Exchange В
120+
x-dead-letter-routing-key : routing.key
121+
x-message-ttl : secondsDelay * 1000
122+
x-expires : secondsDelay * 1000 + 60000
123+
```
124+
- A message, which gets in that queue, will have a specified ttl (time to live) and an exchange to which the message will be sent after expiration.
125+
- That new queue bounds to the **Exchange A**. That queue will be automatically deleted if there are no more messages in it within a minute.
126+
- Message goes to that queue, waits until expiration and goes in the **"Exchange B"**, which routes it as it should be.
127+
- Message gets in the destination queue and consumer can retrieve that message.
128+
113129
For the exchange configuration see the [Previous page](exchange-configuration.md) <br>
114130
For message consumption features see the [Next page](message-consumption.md)
File renamed without changes.

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository contains the library that provides functionality for wrapping [R
77

88
## Usage
99

10-
This section contains only example of basic usage of the library. You can find the [detailed documentation](./docs/documentation.md) in the docs directory where all functionality fully covered.
10+
This section contains only example of basic usage of the library. You can find the [detailed documentation](./docs/index.md) in the docs directory where all functionality fully covered.
1111

1212
### Producer
1313

0 commit comments

Comments
 (0)