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

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.

主站蜘蛛池模板: 五家渠市| 宁化县| 镇平县| 方城县| 喀喇沁旗| 定陶县| 贵德县| 平遥县| 永靖县| 江川县| 安丘市| 灯塔市| 神木县| 临江市| 民权县| 吐鲁番市| 枞阳县| 梁河县| 达日县| 焦作市| 汾阳市| 叙永县| 丰县| 隆德县| 德惠市| 竹北市| 嘉善县| 武平县| 南宫市| 开阳县| 稻城县| 浙江省| 藁城市| 通海县| 绍兴市| 衡南县| 建德市| 峨眉山市| 铅山县| 河北省| 神农架林区|