[rabbitmq-discuss] I'd like rabbitmq to be able to pick its own port(s)

Terry Jones terry at jon.es
Wed Oct 22 01:18:49 BST 2008


The reason I ran into the problem stopping multiple instances of rabbitmq
is that I was just starting to play with it and was wondering about how
port numbers are chosen/assigned.

It would be useful (to me, anyway) if Rabbit could leave port assignment to
the OS and then report on what it gets.

I'd like to locally test some code that simulates multiple machines, each
of which has an instance of rabbit running on it. That means I want to
start multiple instances on my local machine. But rabbit either tries to
use its default 5672 port or lets you choose one. That means that my test
code has to somehow be picking port numbers and is either less reliable or
more complex because it would ideally avoid picking ports that are in use.
If rabbit could just leave it to the OS and then report the port(s) it
gets, that would be nice. Then I could parse its output and know where to
connect to.

Sorry if that all sounds convoluted.  To give an example from the Twisted
[1] world, when I start a twistd service, if I don't tell it what port to
use, it lets the OS allocated it. I can then log it and test code can parse
the log to see where the new service is listening. That makes it easy to
write code that doesn't need to know (or impose) a port number in advance.
So I can have many copies of the same service running on the same machine,
no problem.  That makes local testing of a complex multi-host service much
easier.

Regards,
Terry

[1] http://twistedmatrix.com/trac/




More information about the rabbitmq-discuss mailing list