31
31
32
32
package com .rabbitmq .client .test .functional ;
33
33
34
+ import com .rabbitmq .client .Channel ;
35
+ import com .rabbitmq .client .Connection ;
34
36
import com .rabbitmq .client .GetResponse ;
35
37
import com .rabbitmq .client .QueueingConsumer ;
36
38
@@ -53,6 +55,29 @@ public class BindingLifecycle extends PersisterRestartBase {
53
55
protected static final String X = "X-" + System .currentTimeMillis ();
54
56
protected static final String K = "K-" + System .currentTimeMillis ();
55
57
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
+
56
81
/**
57
82
* Tests whether durable bindings are correctly recovered.
58
83
*/
@@ -112,7 +137,7 @@ public void testDurableBindingsDeletion() throws IOException {
112
137
113
138
114
139
/**
115
- * This tests whether the default bindings for persistent queues
140
+ * This tests whether the default bindings for durable queues
116
141
* are recovered properly.
117
142
*
118
143
* The idea is to create a durable queue, nuke the server and then
0 commit comments