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

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.

主站蜘蛛池模板: 灵石县| 三台县| 周口市| 芦溪县| 洪江市| 龙口市| 宁明县| 融水| 常山县| 闽侯县| 南漳县| 宜都市| 屏山县| 左权县| 呼图壁县| 额敏县| 巫山县| 宝丰县| 黑龙江省| 喀喇沁旗| 德庆县| 巴彦淖尔市| 新蔡县| 万荣县| 香格里拉县| 仁怀市| 鄢陵县| 曲麻莱县| 宜都市| 社会| 凌云县| 大同市| 开江县| 黄骅市| 民权县| 抚州市| 无极县| 衡阳县| 红原县| 东丽区| 浦城县|