3131
3232package com .rabbitmq .client .test .functional ;
3333
34+ import com .rabbitmq .client .Channel ;
35+ import com .rabbitmq .client .Connection ;
3436import com .rabbitmq .client .GetResponse ;
3537import com .rabbitmq .client .QueueingConsumer ;
3638
@@ -53,6 +55,29 @@ public class BindingLifecycle extends PersisterRestartBase {
5355 protected static final String X = "X-" + System .currentTimeMillis ();
5456 protected static final String K = "K-" + System .currentTimeMillis ();
5557
58+ /**
59+ * Create a durable queue on secondary node, if possible, falling
60+ * back on the primary node if necessary.
61+ */
62+ @ Override protected void declareDurableQueue (String q )
63+ throws IOException
64+ {
65+ Connection connection ;
66+ try {
67+ connection = connectionFactory .newConnection ("localhost" , 5673 );
68+ } catch (IOException e ) {
69+ super .declareDurableQueue (q );
70+ return ;
71+ }
72+
73+ Channel channel = connection .createChannel ();
74+
75+ channel .queueDeclare (q , true );
76+
77+ channel .abort ();
78+ connection .abort ();
79+ }
80+
5681 /**
5782 * Tests whether durable bindings are correctly recovered.
5883 */
@@ -112,7 +137,7 @@ public void testDurableBindingsDeletion() throws IOException {
112137
113138
114139 /**
115- * This tests whether the default bindings for persistent queues
140+ * This tests whether the default bindings for durable queues
116141 * are recovered properly.
117142 *
118143 * The idea is to create a durable queue, nuke the server and then
0 commit comments