@@ -62,10 +62,10 @@ public void testRepublishOnNackThreadNoExchange() throws Exception {
62
62
template .setConfirmCallback ((cd , a , c ) -> {
63
63
confirmLatch .countDown ();
64
64
if (confirmLatch .getCount () == 1 ) {
65
- template .convertAndSend (QUEUE1 , (( MyCD ) cd ). payload );
65
+ template .convertAndSend (QUEUE1 , cd . getId () );
66
66
}
67
67
});
68
- template .convertAndSend ("bad.exchange" , "junk" , "foo" , new MyCD ("foo" ));
68
+ template .convertAndSend ("bad.exchange" , "junk" , "foo" , new CorrelationData ("foo" ));
69
69
assertThat (confirmLatch .await (10 , TimeUnit .SECONDS )).isTrue ();
70
70
assertThat (template .receive (QUEUE1 , 10_000 )).isNotNull ();
71
71
}
@@ -97,7 +97,8 @@ public void testDeferredChannelCacheNack() throws Exception {
97
97
channel2 .close ();
98
98
conn .close ();
99
99
assertThat (TestUtils .getPropertyValue (cf , "cachedChannelsNonTransactional" , List .class ).size ()).isEqualTo (2 );
100
- template .convertAndSend ("" , QUEUE2 + "junk" , "foo" , new MyCD ("foo" ));
100
+ CorrelationData correlationData = new CorrelationData ("foo" );
101
+ template .convertAndSend ("" , QUEUE2 + "junk" , "foo" , correlationData );
101
102
assertThat (returnLatch .await (10 , TimeUnit .SECONDS )).isTrue ();
102
103
assertThat (confirmLatch .await (10 , TimeUnit .SECONDS )).isTrue ();
103
104
int n = 0 ;
@@ -106,6 +107,7 @@ public void testDeferredChannelCacheNack() throws Exception {
106
107
}
107
108
assertThat (cacheCount .get ()).isEqualTo (1 );
108
109
assertThat (returnCalledFirst .get ()).isTrue ();
110
+ assertThat (correlationData .getReturnedMessage ()).isNotNull ();
109
111
cf .destroy ();
110
112
}
111
113
@@ -129,7 +131,7 @@ public void testDeferredChannelCacheAck() throws Exception {
129
131
channel2 .close ();
130
132
conn .close ();
131
133
assertThat (TestUtils .getPropertyValue (cf , "cachedChannelsNonTransactional" , List .class ).size ()).isEqualTo (2 );
132
- template .convertAndSend ("" , QUEUE2 , "foo" , new MyCD ("foo" ));
134
+ template .convertAndSend ("" , QUEUE2 , "foo" , new CorrelationData ("foo" ));
133
135
assertThat (confirmLatch .await (10 , TimeUnit .SECONDS )).isTrue ();
134
136
assertThat (cacheCount .get ()).isEqualTo (1 );
135
137
cf .destroy ();
@@ -146,22 +148,11 @@ public void testTwoSendsAndReceivesDRTMLC() throws Exception {
146
148
template .setConfirmCallback ((cd , a , c ) -> {
147
149
confirmLatch .countDown ();
148
150
});
149
- template .convertSendAndReceive ("" , QUEUE3 , "foo" , new MyCD ("foo" ));
150
- template .convertSendAndReceive ("" , QUEUE3 , "foo" , new MyCD ("foo" )); // listener not registered
151
+ template .convertSendAndReceive ("" , QUEUE3 , "foo" , new CorrelationData ("foo" ));
152
+ template .convertSendAndReceive ("" , QUEUE3 , "foo" , new CorrelationData ("foo" )); // listener not registered
151
153
assertThat (confirmLatch .await (10 , TimeUnit .SECONDS )).isTrue ();
152
154
assertThat (template .receive (QUEUE3 , 10_000 )).isNotNull ();
153
155
assertThat (template .receive (QUEUE3 , 10_000 )).isNotNull ();
154
156
}
155
157
156
-
157
- private static class MyCD extends CorrelationData {
158
-
159
- final String payload ;
160
-
161
- MyCD (String payload ) {
162
- this .payload = payload ;
163
- }
164
-
165
- }
166
-
167
158
}
0 commit comments