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

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.

主站蜘蛛池模板: 呼伦贝尔市| 连平县| 三穗县| 那坡县| 阿拉善左旗| 贡嘎县| 福建省| 舟山市| 乌什县| 利津县| 吐鲁番市| 南乐县| 府谷县| 怀远县| 阳高县| 淳化县| 濮阳市| 中山市| 崇州市| 镇宁| 绥滨县| 固原市| 桃园县| 柳河县| 九江市| 邹平县| 清丰县| 泗洪县| 北宁市| 安泽县| 突泉县| 绥阳县| 浪卡子县| 板桥市| 南部县| 赤壁市| 临朐县| 肥西县| 子洲县| 宁阳县| 苍南县|