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

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.

主站蜘蛛池模板: 罗源县| 佳木斯市| 公主岭市| 资溪县| 通城县| 宁波市| 收藏| 洪雅县| 荔浦县| 铁岭市| 盐源县| 新沂市| 唐山市| 蒙城县| 甘肃省| 四子王旗| 澄江县| 望江县| 舞阳县| 大渡口区| 伊宁市| 莱芜市| 德庆县| 洛隆县| 天气| 安图县| 朝阳市| 临江市| 太保市| 怀来县| 南丰县| 铁力市| 恭城| 涟水县| 石城县| 利津县| 太康县| 抚州市| 德惠市| 西宁市| 福贡县|