You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 29, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: docs/message-consumption.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -311,4 +311,6 @@ The message handling process is organized as follows:
311
311
- If any exception occurs `IMessageHandlingService` acknowledges the message anyway and checks if the message has to be re-send. If exchange option `RequeueFailedMessages` is set `true` then `IMessageHandlingService` adds a header `"requeued"` to the message and sends it again with delay in 60 seconds. Mechanism of sending delayed messages covered in the message production [documentation](message-production.md).
312
312
- If any exception occurs within handling the message that has been already re-sent that message will not be re-send again (re-send happens only once).
313
313
314
-
For message production features see the [Previous page](message-production.md)
314
+
For message production features see the [Previous page](message-production.md)
315
+
316
+
For more information about advanced usage of the RabbitMQ client see the [Next page](advanced-usage.md)
Copy file name to clipboardExpand all lines: docs/readme.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,12 @@ These files cover all functionality of the library and if the new feature comes
4
4
Documentation consists of four sections. **RabbitMQ configuration section** covers ways of configuring the connection to the RabbitMQ host or multiple hosts (HA cluster).
5
5
**Exchange configuration section** explains the difference between consumption and production exchanges in terms of this library as well as specific nuances of configuring them.
6
6
**Message production section** says about features of sending messages and **message consuming section** covers ways of receiving and handling messages.
7
+
Last section **Advanced usage** covers specific usage of the RabbitMQ client that can be useful for users who want to control behavior of RabbitMQ client tighter.
By calling `AddRabbitMqClient` you add `IQueueService` that provides functionality of sending messages to queues. `AddProductionExchange` configures exchange to queues bindings (presented in json configuration) that allow messages to route properly.
29
+
By calling `AddRabbitMqClient` you add `IQueueService` that provides functionality of sending messages to queues. `AddProductionExchange` configures exchange to queues bindings (presented in json configuration) that allow messages to route properly.
30
30
Example of `appsettings.json` is two sections below. You can also configure everything manually. For more information, see [rabbit-configuration](./docs/rabbit-configuration.md) and [exchange-configuration](./docs/exchange-configuration.md) documentation files.
31
31
32
32
Now you can inject an instance of `IQueueService` inside anything you want.
@@ -69,7 +69,7 @@ _queueService.Send(
69
69
```
70
70
71
71
The mechanism of sending delayed messages described in the [documentation](./docs/message-production.md). Dive into it for more detailed information.
72
-
72
+
73
73
### Consumer
74
74
75
75
After making the message production possible let's make the consumption possible too! Imagine that a consumer is a simple console application.
@@ -132,20 +132,82 @@ public class CustomMessageHandler : IMessageHandler
132
132
{
133
133
_logger=logger;
134
134
}
135
-
135
+
136
136
publicvoidHandle(stringmessage, stringroutingKey)
137
137
{
138
138
// Do whatever you want with the message.
139
139
_logger.LogInformation("Hello world");
140
140
}
141
141
}
142
142
```
143
-
There are async and non-cyclic message handler types, which allow you to do additional stuff. For more information, see the [message-consuming](./docs/message-consumption.md) documentation file.
143
+
144
+
If you want to use an async magic then implement your custom `IAsyncMessageHandler`.
If you want to send messages from the `Handle` method inside your message handler then use `INonCyclicMessageHandler`.
163
+
You can't inject `IQueueService` inside any message handlers, otherwise you will get a cyclic dependency exception. But `INonCyclicMessageHandler` allows you to avoid this as it accepts an instance of `IQueueService` as a parameter of the method `Handle`.
You can register any of those message handlers the same way you registered `IMessageHandler` before. There are similar extension methods for each type of message handlers. For more information, see the [message-consuming](./docs/message-consumption.md) documentation file.
144
206
145
207
You can also find example projects in the repository inside the [examples](./examples) directory.
146
208
147
209
### Configuration
148
-
210
+
149
211
In both cases for producing and consuming messages the configuration file is the same. `appsettings.json` consists of those sections: (1) settings to connect to the RabbitMQ server and (2) sections that configure exchanges and queue bindings. You can have multiple exchanges and one configuration section per each exchange.
150
212
Exchange sections define how to bind queues and exchanges with each other using specified routing keys (or patterns). You allowed to bind a queue to an exchange with more than one routing key, but if there are no routing keys in the queue section, then that queue will be bound to the exchange with its name.
151
213
@@ -175,6 +237,10 @@ Exchange sections define how to bind queues and exchanges with each other using
175
237
176
238
For more information about `appsettings.json` and manual configuration features, see [rabbit-configuration](./docs/rabbit-configuration.md) and [exchange-configuration](./docs/exchange-configuration.md) documentation files.
177
239
240
+
## Important nuances and advanced usage
241
+
242
+
RabbitMQ client implemented in this library (class which implements `IQueueService`) opens two connections to the RabbitMQ server. One connection is used for message production and the other one is for message consumption. This behavior embedded since 3.2.0 version of the library.
243
+
178
244
## Changelog
179
245
180
246
All notable changes are being tracked in the [changelog](./docs/changelog.md) file.
0 commit comments