bloomberg/amqpprox

Can't add more than one DNS based backends with the same port

kriptor opened this issue · 1 comments

Describe the bug
This sequence doesn't work:

BACKEND ADD_DNS b1 dc1 rabbitcluster1-lb.example.com 5672
BACKEND ADD_DNS b2 dc1 rabbitcluster2-lb.example.com 5672

Backend addresses are stored with IP&port key and thus you can't have two DNS based backends on the same port... IP is always "" when using ADD_DNS. Maybe it could just resolve the hostname even when using ADD_DNS.

To Reproduce
Steps to reproduce the behavior:

  1. start amqpprox server
  2. execute BACKEND ADD_DNS b1 dc1 rabbitcluster1-lb.example.com 5672 (all good)
  3. execute BACKEND ADD_DNS b2 dc1 rabbitcluster2-lb.example.com 5672 (fails)
  4. error output from amqprox_ctl: Failed to insert backend: 'b2 (dc1): rabbitcluster2-lb.example.com :5672', error code: 1

Expected behavior
It is very much common to run multiple RabbitMQ services on the same port. :)

Environment (please complete the following information):

  • Makes no difference, I guess... I encountered identical results running it on Darwin and Linux

Thanks for the bug report & easy reproduction steps - the PR above should address this 🙂