8000 Improve docs around recovery listeners · panchenko/rabbitmq-java-client@ee11f5c · GitHub
[go: up one dir, main page]

Skip to content

Commit ee11f5c

Browse files
Improve docs around recovery listeners
1 parent 7d9eef9 commit ee11f5c

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

src/com/rabbitmq/client/Connection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
101101

102102
/**
103103
* Create a new channel, using an internally allocated channel number.
104+
* If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
105+
* is enabled, the channel returned by this method will be {@link Recoverable}.
106+
*
104107
* @return a new channel descriptor, or null if none is available
105108
* @throws IOException if an I/O problem is encountered
106109
*/

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,16 +530,19 @@ public void useSslProtocol(SSLContext context)
530530
}
531531

532532
/**
533-
* Returns true if automatic connection recovery is enabled, false otherwise
533+
* Returns true if <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
534+
* is enabled, false otherwise
534535
* @return true if automatic connection recovery is enabled, false otherwise
536+
* @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
535537
*/
536538
public boolean isAutomaticRecoveryEnabled() {
537539
return automaticRecovery;
538540
}
539541

540542
/**
541-
* Enables or disables automatic connection recovery
543+
* Enables or disables <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>.
542544
* @param automaticRecovery if true, enables connection recovery
545+
* @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
543546
*/
544547
public void setAutomaticRecoveryEnabled(boolean automaticRecovery) {
545548
this.automaticRecovery = automaticRecovery;
@@ -548,6 +551,7 @@ public void setAutomaticRecoveryEnabled(boolean automaticRecovery) {
548551
/**
549552
* Returns true if topology recovery is enabled, false otherwise
550553
* @return true if topology recovery is enabled, false otherwise
554+
* @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
551555
*/
552556
@SuppressWarnings("unused")
553557
public boolean isTopologyRecoveryEnabled() {
@@ -557,6 +561,7 @@ public boolean isTopologyRecoveryEnabled() {
557561
/**
558562
* Enables or disables topology recovery
559563
* @param topologyRecovery if true, enables topology recovery
564+
* @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
560565
*/
561566
public void setTopologyRecoveryEnabled(boolean topologyRecovery) {
562567
this.topologyRecovery = topologyRecovery;
@@ -567,7 +572,13 @@ protected FrameHandlerFactory createFrameHandlerFactory() throws IOException {
567572
}
568573

569574
/**
570-
* Create a new broker connection
575+
* Create a new broker connection, picking the first available address from
576+
* the list.
577+
*
578+
* If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
579+
* is enabled, the connection returned by this method will be {@link Recoverable}. Future
580+
* reconnection attempts will pick a random accessible address from the provided list.
581+
*
571582
* @param addrs an array of known broker addresses (hostname/port pairs) to try in order
572583
* @return an interface to the connection
573584
* @throws IOException if it encounters a problem
@@ -577,11 +588,18 @@ public Connection newConnection(Address[] addrs) throws IOException {
577588
}
578589

579590
/**
580-
* Create a new broker connection
591+
* Create a new broker connection, picking the first available address from
592+
* the list.
593+
*
594+
* If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
595+
* is enabled, the connection returned by this method will be {@link Recoverable}. Future
596+
* reconnection attempts will pick a random accessible address from the provided list.
597+
*
581598
* @param executor thread execution service for consumers on the connection
582599
* @param addrs an array of known broker addresses (hostname/port pairs) to try in order
583600
* @return an interface to the connection
584601
* @throws java.io.IOException if it encounters a problem
602+
* @see <a href="http://www.rabbitmq.com/api-guide.html#recovery">Automatic Recovery</a>
585603
*/
586604
public Connection newConnection(ExecutorService executor, Address[] addrs)
587605
throws IOException
@@ -617,7 +635,12 @@ public ConnectionParams params(ExecutorService executor) {
617635
}
618636

619637
/**
620-
* Create a new broker connection
638+
* Create a new broker connection.
639+
*
640+
* If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
641+
* is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection
642+
* attempts will always use the address configured on {@link ConnectionFactory}.
643+
*
621644
* @return an interface to the connection
622645
* @throws IOException if it encounters a problem
623646
*/
@@ -628,7 +651,12 @@ public Connection newConnection() throws IOException {
628651
}
629652

630653
/**
631-
* Create a new broker connection
654+
* Create a new broker connection.
655+
*
656+
* If <a href="http://www.rabbitmq.com/api-guide.html#recovery">automatic connection recovery</a>
657+
* is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection
658+
* attempts will always use the address configured on {@link ConnectionFactory}.
659+
*
632660
* @param executor thread execution service for consumers on the connection
633661
* @return an interface to the connection
634662
* @throws IOException if it encounters a problem

src/com/rabbitmq/client/Recoverable.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
/**
44
* Provides a way to register (network, AMQP 0-9-1) connection recovery
55
* callbacks.
6+
*
7+
* When connection recovery is enabled via {@link ConnectionFactory},
8+
* {@link ConnectionFactory#newConnection()} and {@link Connection#createChannel()}
9+
* return {@link Recoverable} connections and channels.
10+
*
11+
* @see com.rabbitmq.client.impl.recovery.AutorecoveringConnection
12+
* @see com.rabbitmq.client.impl.recovery.AutorecoveringChannel
613
*/
714
public interface Recoverable {
815
/**

0 commit comments

Comments
 (0)
0