rabbitmq-java-client icon indicating copy to clipboard operation
rabbitmq-java-client copied to clipboard

Accept endpoint list as java.util.List

Open michaelklishin opened this issue 10 years ago • 5 comments

Using arrays only in 2016 is a little embarrassing, isn't it?

michaelklishin avatar Jan 25 '16 09:01 michaelklishin

I should elaborate: ConnectionFactory#newConnection currently accepts an array of Addresses. Lists are much more common in modern Java. We cannot remove the existing method because it would break too many apps but we can introduce a new version of that method and switch to Lists internally. Then this can go into 3.6.x.

michaelklishin avatar Jan 25 '16 14:01 michaelklishin

Is the internal switch to Lists part of the scope of this issue, or is it just to introduce a newConnection() method that accepts a List as an argument?

bdshroyer avatar Jan 25 '16 18:01 bdshroyer

Sure, lets switch the internal addresses field(s) to use List. Arrays are rarely used in modern Java.

michaelklishin avatar Jan 25 '16 19:01 michaelklishin

You might want to provide a new version of parseAddresses method returning List. Providing both the methods returning Array and List can be confusing, though.

https://github.com/rabbitmq/rabbitmq-java-client/blob/bba45a8276c0c77505b2fc770192f2a2f2922de5/src/main/java/com/rabbitmq/client/Address.java#L83

occho avatar Mar 03 '16 05:03 occho

@occho good idea. Well, we can't remove the array version yet, so…

michaelklishin avatar Mar 03 '16 09:03 michaelklishin