@@ -650,20 +650,24 @@ public Connection newConnection(Address[] addrs) throws IOException, TimeoutExce
650650
651651
652652 /**
653- * Create a new broker connection, picking the first available address from
653+ * Create a new broker connection with a client-provided name , picking the first available address from
654654 * the list.
655655 *
656656 * If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
657657 * is enabled, the connection returned by this method will be {@link Recoverable}. Future
658658 * reconnection attempts will pick a random accessible address from the provided list.
659659 *
660660 * @param addrs an array of known broker addresses (hostname/port pairs) to try in order
661- * @param connectionName arbitrary sring for connection name client property
661+ * @param clientProvidedName application-specific connection name, will be displayed
662+ * in the management UI if RabbitMQ server supports it.
663+ * This value doesn't have to be unique and cannot be used
664+ * as a connection identifier e.g. in HTTP API requests.
665+ * This value is supposed to be human-readable.
662666 * @return an interface to the connection
663667 * @throws IOException if it encounters a problem
664668 */
665- public Connection newConnection (Address [] addrs , String connectionName ) throws IOException , TimeoutException {
666- return newConnection (this .sharedExecutor , Arrays .asList (addrs ), connectionName );
669+ public Connection newConnection (Address [] addrs , String clientProvidedName ) throws IOException , TimeoutException {
670+ return newConnection (this .sharedExecutor , Arrays .asList (addrs ), clientProvidedName );
667671 }
668672
669673 /**
@@ -683,20 +687,24 @@ public Connection newConnection(List<Address> addrs) throws IOException, Timeout
683687 }
684688
685689 /**
686- * Create a new broker connection, picking the first available address from
690+ * Create a new broker connection with a client-provided name , picking the first available address from
687691 * the list.
688692 *
689693 * If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
690694 * is enabled, the connection returned by this method will be {@link Recoverable}. Future
691695 * reconnection attempts will pick a random accessible address from the provided list.
692696 *
693697 * @param addrs a List of known broker addresses (hostname/port pairs) to try in order
694- * @param connectionName arbitrary sring for connection name client property
698+ * @param clientProvidedName application-specific connection name, will be displayed
699+ * in the management UI if RabbitMQ server supports it.
700+ * This value doesn't have to be unique and cannot be used
701+ * as a connection identifier e.g. in HTTP API requests.
702+ * This value is supposed to be human-readable.
695703 * @return an interface to the connection
696704 * @throws IOException if it encounters a problem
697705 */
698- public Connection newConnection (List <Address > addrs , String connectionName ) throws IOException , TimeoutException {
699- return newConnection (this .sharedExecutor , addrs , connectionName );
706+ public Connection newConnection (List <Address > addrs , String clientProvidedName ) throws IOException , TimeoutException {
707+ return newConnection (this .sharedExecutor , addrs , clientProvidedName );
700708 }
701709
702710 /**
@@ -719,7 +727,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs) throw
719727
720728
721729 /**
722- * Create a new broker connection, picking the first available address from
730+ * Create a new broker connection with a client-provided name , picking the first available address from
723731 * the list.
724732 *
725733 * If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
@@ -728,13 +736,17 @@ public Connection newConnection(ExecutorService executor, Address[] addrs) throw
728736 *
729737 * @param executor thread execution service for consumers on the connection
730738 * @param addrs an array of known broker addresses (hostname/port pairs) to try in order
731- * @param connectionName arbitrary sring for connection name client property
739+ * @param clientProvidedName application-specific connection name, will be displayed
740+ * in the management UI if RabbitMQ server supports it.
741+ * This value doesn't have to be unique and cannot be used
742+ * as a connection identifier e.g. in HTTP API requests.
743+ * This value is supposed to be human-readable.
732744 * @return an interface to the connection
733745 * @throws java.io.IOException if it encounters a problem
734746 * @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
735747 */
736- public Connection newConnection (ExecutorService executor , Address [] addrs , String connectionName ) throws IOException , TimeoutException {
737- return newConnection (executor , Arrays .asList (addrs ), connectionName );
748+ public Connection newConnection (ExecutorService executor , Address [] addrs , String clientProvidedName ) throws IOException , TimeoutException {
749+ return newConnection (executor , Arrays .asList (addrs ), clientProvidedName );
738750 }
739751
740752 /**
@@ -756,7 +768,7 @@ public Connection newConnection(ExecutorService executor, List<Address> addrs) t
756768 }
757769
758770 /**
759- * Create a new broker connection, picking the first available address from
771+ * Create a new broker connection with a client-provided name , picking the first available address from
760772 * the list.
761773 *
762774 * If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
@@ -765,20 +777,24 @@ public Connection newConnection(ExecutorService executor, List<Address> addrs) t
765777 *
766778 * @param executor thread execution service for consumers on the connection
767779 * @param addrs a List of known broker addrs (hostname/port pairs) to try in order
768- * @param connectionName arbitrary sring for connection name client property
780+ * @param clientProvidedName application-specific connection name, will be displayed
781+ * in the management UI if RabbitMQ server supports it.
782+ * This value doesn't have to be unique and cannot be used
783+ * as a connection identifier e.g. in HTTP API requests.
784+ * This value is supposed to be human-readable.
769785 * @return an interface to the connection
770786 * @throws java.io.IOException if it encounters a problem
771787 * @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
772788 */
773- public Connection newConnection (ExecutorService executor , List <Address > addrs , String connectionName )
789+ public Connection newConnection (ExecutorService executor , List <Address > addrs , String clientProvidedName )
774790 throws IOException , TimeoutException {
775791 // make sure we respect the provided thread factory
776792 FrameHandlerFactory fhFactory = createFrameHandlerFactory ();
777793 ConnectionParams params = params (executor );
778- // set connection name client property
779- if (connectionName != null ) {
794+ // set client-provided via a client property
795+ if (clientProvidedName != null ) {
780796 Map <String , Object > properties = new HashMap <String , Object >(params .getClientProperties ());
781- properties .put ("connection_name" , connectionName );
797+ properties .put ("connection_name" , clientProvidedName );
782798 params .setClientProperties (properties );
783799 }
784800
0 commit comments