Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to break a connection from rabbitmq

I've got an application which has some bugs. For some reason 2 consumers are created when only one should be there - and one of them is not checked for messages anymore.

I can detect that situation by listing queues and the number of consumers on the server. Is there some way to destroy that consumer from the server side?

like image 553
viraptor Avatar asked Aug 18 '11 23:08

viraptor


2 Answers

consumer can be kill by rabbitmqctl using close_connection input connectionpid

example

> rabbitmqctl close_connection "<[email protected]>" "reason here"

connectionpid can get by

> rabbitmqctl list_consumers

Listing consumers ...
send_email_1    <[email protected]>   amq.ctag-oim8CCP2hsioWc-3WwS-qQ true    1   []
send_email_2    <[email protected]>   amq.ctag-WxpxDglqZQN2FNShN4g7QA true    1   []

RabbitMQ 3.5.4

like image 190
Hardy Avatar answered Dec 25 '22 00:12

Hardy


You can kill connections to the RabbitMQ broker using the rabbitmqctl tool (see the man page) or by using the Web UI. You could also purge and delete the queue which belonged to the rogue consumer.

However, you can't kill the consumer process itself using those tools. You really should just focus on fixing the bugs in the application so that only the correct number of consumers get created.

like image 35
Brian Kelly Avatar answered Dec 25 '22 00:12

Brian Kelly