官术网_书友最值得收藏!

Canceling subscriptions

All the subscribe methods return an ISubscriptionResult. It contains properties that describe the IExchange and IQueue used by the underlying IConsumer; these can be further manipulated using the advanced API IAdvancedBus if required.

You can cancel a subscriber at any time by calling Dispose on the ISubscriptionResult instance or on its ConsumerCancellation property:

var subscriptionResult = bus.Subscribe<MyMessage>("sub_id", MyHandler);
subscriptionResult.Dispose();

This will stop EasyNetQ consuming from the queue and close the consumer's channel. It is the equivalent to calling subscriptionResult.ConsumerCancellation.Dispose();

Note that disposing of the IBus or IAdvancedBus instance will also cancel all consumers and close the connection to RabbitMQ.

主站蜘蛛池模板: 都安| 瑞安市| 定安县| 昌平区| 弥勒县| 易门县| 武威市| 会同县| 仲巴县| 古蔺县| 齐齐哈尔市| 日照市| 康平县| 伊吾县| 南丹县| 将乐县| 肃北| 项城市| 泾源县| 区。| 连城县| 喜德县| 顺义区| 沁源县| 钟山县| 丰原市| 奉节县| 鄂温| 五台县| 二连浩特市| 潼南县| 安岳县| 乌兰县| 合水县| 诸城市| 兴仁县| 金沙县| 泌阳县| 林甸县| 邳州市| 宁安市|