. Net RabbitMQ operation component EasyNetQ WithTopic filtering failure solution, rabbitmqeasynetq

Source: Internet
Author: User

. Net RabbitMQ operation component EasyNetQ WithTopic filtering failure solution, rabbitmqeasynetq

RabbitMQ principle and Tutorial: http://www.cnblogs.com/AlvinLee/p/6141834.html

What is EasyNetQ and its common usage are not described here. Can refer to this blog: http://blog.csdn.net/hesi9555/article/details/70139346

Here we will talk about a point in the WithTopic method in EasyNetQ that is easy to waste a lot of time.

After using the Subscribe method of EasyNetQ and then using the SubscribeWithTopic method, you may find that no matter what the Routing Key (the third parameter in the SubscribeWithTopic) writes, no matter whether your Routing key is the same or different from the sender's Routing Key, the receiver can all receive it, that is, the WithTopic filter function is invalid. Why?

At this time, as long as you open the queue Panel of the RabbitMQ web management background,

(Http: // localhost: 15672/#/queues. If you cannot open it, right-click the sbin directory of rabbitmq-server to open the command line and run

.\rabbitmq-plugins.bat enable rabbitmq_management

To start the web management background .)

Click the newly created queue and open the bindings drop-down menu. If you see "#" in the Routing key column, it means that all the Routing keys added later are invalid. # Accept all. Each time you run Subscribe, the "#" filter rule is automatically added and set to the top.

Solutions:

1. manually delete the file. "#" Click the unbind button. If Subscribe is used and you want to change it to SubscribeWithTopic, you must manually delete it again.

2. Use the code to delete the file.

Var bus = rabbithuch. CreateBus (connectionString );
IAdvancedBus advancedBus = bus. advanced; IBinding bind = advancedBus. bind (new Exchange ("Model. message: Model (vswitch name) "), new Queue (" Model. message: Model_id1 (queue name) ", false)," # "); advancedBus. bindingDelete (bind );

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.