1
1
/*
2
- * Copyright 2016-2019 the original author or authors.
2
+ * Copyright 2020-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
16
16
17
17
package org .springframework .amqp .core ;
18
18
19
+ import java .util .concurrent .CompletableFuture ;
20
+
19
21
import org .springframework .core .ParameterizedTypeReference ;
20
- import org .springframework .util .concurrent .ListenableFuture ;
21
22
22
23
/**
23
24
* Classes implementing this interface can perform asynchronous send and
24
- * receive operations.
25
+ * receive operations using {@link CompletableFuture}s .
25
26
*
26
27
* @author Gary Russell
27
28
* @since 2.0
@@ -33,47 +34,47 @@ public interface AsyncAmqpTemplate {
33
34
* Send a message to the default exchange with the default routing key. If the message
34
35
* contains a correlationId property, it must be unique.
35
36
* @param message the message.
36
- * @return the {@link ListenableFuture }.
37
+ * @return the {@link CompletableFuture }.
37
38
*/
38
- ListenableFuture <Message > sendAndReceive (Message message );
39
+ CompletableFuture <Message > sendAndReceive (Message message );
39
40
40
41
/**
41
42
* Send a message to the default exchange with the supplied routing key. If the message
42
43
* contains a correlationId property, it must be unique.
43
44
* @param routingKey the routing key.
44
45
* @param message the message.
45
- * @return the {@link ListenableFuture }.
46
+ * @return the {@link CompletableFuture }.
46
47
*/
47
- ListenableFuture <Message > sendAndReceive (String routingKey , Message message );
48
+ CompletableFuture <Message > sendAndReceive (String routingKey , Message message );
48
49
49
50
/**
50
51
* Send a message to the supplied exchange and routing key. If the message
51
52
* contains a correlationId property, it must be unique.
52
53
* @param exchange the exchange.
53
54
* @param routingKey the routing key.
54
55
* @param message the message.
55
- * @return the {@link ListenableFuture }.
56
+ * @return the {@link CompletableFuture }.
56
57
*/
57
- ListenableFuture <Message > sendAndReceive (String exchange , String routingKey , Message message );
58
+ CompletableFuture <Message > sendAndReceive (String exchange , String routingKey , Message message );
58
59
59
60
/**
60
61
* Convert the object to a message and send it to the default exchange with the
61
62
* default routing key.
62
63
* @param object the object to convert.
63
64
* @param <C> the expected result type.
64
- * @return the {@link ListenableFuture }.
65
+ * @return the {@link CompletableFuture }.
65
66
*/
66
- <C > ListenableFuture <C > convertSendAndReceive (Object object );
67
+ <C > CompletableFuture <C > convertSendAndReceive (Object object );
67
68
68
69
/**
69
70
* Convert the object to a message and send it to the default exchange with the
70
71
* provided routing key.
71
72
* @param routingKey the routing key.
72
73
* @param object the object to convert.
73
74
* @param <C> the expected result type.
74
- * @return the {@link ListenableFuture }.
75
+ * @return the {@link CompletableFuture }.
75
76
*/
76
- <C > ListenableFuture <C > convertSendAndReceive (String routingKey , Object object );
77
+ <C > CompletableFuture <C > convertSendAndReceive (String routingKey , Object object );
77
78
78
79
/**
79
80
* Convert the object to a message and send it to the provided exchange and
@@ -82,9 +83,9 @@ public interface AsyncAmqpTemplate {
82
83
* @param routingKey the routing key.
83
84
* @param object the object to convert.
84
85
* @param <C> the expected result type.
85
- * @return the {@link ListenableFuture }.
86
+ * @return the {@link CompletableFuture }.
86
87
*/
87
- <C > ListenableFuture <C > convertSendAndReceive (String exchange , String routingKey , Object object );
88
+ <C > CompletableFuture <C > convertSendAndReceive (String exchange , String routingKey , Object object );
88
89
89
90
/**
90
91
* Convert the object to a message and send it to the default exchange with the
@@ -93,9 +94,9 @@ public interface AsyncAmqpTemplate {
93
94
* @param object the object to convert.
94
95
* @param messagePostProcessor the post processor.
95
96
* @param <C> the expected result type.
96
- * @return the {@link ListenableFuture }.
97
+ * @return the {@link CompletableFuture }.
97
98
*/
98
- <C > ListenableFuture <C > convertSendAndReceive (Object object , MessagePostProcessor messagePostProcessor );
99
+ <C > CompletableFuture <C > convertSendAndReceive (Object object , MessagePostProcessor messagePostProcessor );
99
100
100
101
/**
101
102
* Convert the object to a message and send it to the default exchange with the
@@ -105,9 +106,9 @@ public interface AsyncAmqpTemplate {
105
106
* @param object the object to convert.
106
107
* @param messagePostProcessor the post processor.
107
108
* @param <C> the expected result type.
108
- * @return the {@link ListenableFuture }.
109
+ * @return the {@link CompletableFuture }.
109
110
*/
110
- <C > ListenableFuture <C > convertSendAndReceive (String routingKey , Object object ,
111
+ <C > CompletableFuture <C > convertSendAndReceive (String routingKey , Object object ,
111
112
MessagePostProcessor messagePostProcessor );
112
113
113
114
/**
@@ -119,9 +120,9 @@ <C> ListenableFuture<C> convertSendAndReceive(String routingKey, Object object,
119
120
* @param object the object to convert.
120
121
* @param messagePostProcessor the post processor.
121
122
* @param <C> the expected result type.
122
- * @return the {@link ListenableFuture }.
123
+ * @return the {@link CompletableFuture }.
123
124
*/
124
- <C > ListenableFuture <C > convertSendAndReceive (String exchange , String routingKey , Object object ,
125
+ <C > CompletableFuture <C > convertSendAndReceive (String exchange , String routingKey , Object object ,
125
126
MessagePostProcessor messagePostProcessor );
126
127
127
128
/**
@@ -130,9 +131,9 @@ <C> ListenableFuture<C> convertSendAndReceive(String exchange, String routingKey
130
131
* @param object the object to convert.
131
132
* @param responseType the response type.
132
133
* @param <C> the expected result type.
133
- * @return the {@link ListenableFuture }.
134
+ * @return the {@link CompletableFuture }.
134
135
*/
135
- <C > ListenableFuture <C > convertSendAndReceiveAsType (Object object , ParameterizedTypeReference <C > responseType );
136
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (Object object , ParameterizedTypeReference <C > responseType );
136
137
137
138
/**
138
139
* Convert the object to a message and send it to the default exchange with the
@@ -141,9 +142,9 @@ <C> ListenableFuture<C> convertSendAndReceive(String exchange, String routingKey
141
142
* @param object the object to convert.
142
143
* @param responseType the response type.
143
144
* @param <C> the expected result type.
144
- * @return the {@link ListenableFuture }.
145
+ * @return the {@link CompletableFuture }.
145
146
*/
146
- <C > ListenableFuture <C > convertSendAndReceiveAsType (String routingKey , Object object ,
147
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (String routingKey , Object object ,
147
148
ParameterizedTypeReference <C > responseType );
148
149
149
150
/**
@@ -154,9 +155,9 @@ <C> ListenableFuture<C> convertSendAndReceiveAsType(String routingKey, Object ob
154
155
* @param object the object to convert.
155
156
* @param responseType the response type.
156
157
* @param <C> the expected result type.
157
- * @return the {@link ListenableFuture }.
158
+ * @return the {@link CompletableFuture }.
158
159
*/
159
- <C > ListenableFuture <C > convertSendAndReceiveAsType (String exchange , String routingKey , Object object ,
160
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (String exchange , String routingKey , Object object ,
160
161
ParameterizedTypeReference <C > responseType );
161
162
162
163
/**
@@ -167,9 +168,9 @@ <C> ListenableFuture<C> convertSendAndReceiveAsType(String exchange, String rout
167
168
* @param messagePostProcessor the post processor.
168
169
* @param responseType the response type.
169
170
* @param <C> the expected result type.
170
- * @return the {@link ListenableFuture }.
171
+ * @return the {@link CompletableFuture }.
171
172
*/
172
- <C > ListenableFuture <C > convertSendAndReceiveAsType (Object object , MessagePostProcessor messagePostProcessor ,
173
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (Object object , MessagePostProcessor messagePostProcessor ,
173
174
ParameterizedTypeReference <C > responseType );
174
175
175
176
/**
@@ -181,9 +182,9 @@ <C> ListenableFuture<C> convertSendAndReceiveAsType(Object object, MessagePostPr
181
182
* @param messagePostProcessor the post processor.
182
183
* @param responseType the response type.
183
184
* @param <C> the expected result type.
184
- * @return the {@link ListenableFuture }.
185
+ * @return the {@link CompletableFuture }.
185
186
*/
186
- <C > ListenableFuture <C > convertSendAndReceiveAsType (String routingKey , Object object ,
187
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (String routingKey , Object object ,
187
188
MessagePostProcessor messagePostProcessor , ParameterizedTypeReference <C > responseType );
188
189
189
190
/**
@@ -196,9 +197,9 @@ <C> ListenableFuture<C> convertSendAndReceiveAsType(String routingKey, Object ob
196
197
* @param messagePostProcessor the post processor.
197
198
* @param responseType the response type.
198
199
* @param <C> the expected result type.
199
- * @return the {@link ListenableFuture }.
200
+ * @return the {@link CompletableFuture }.
200
201
*/
201
- <C > ListenableFuture <C > convertSendAndReceiveAsType (String exchange , String routingKey , Object object ,
202
+ <C > CompletableFuture <C > convertSendAndReceiveAsType (String exchange , String routingKey , Object object ,
202
203
MessagePostProcessor messagePostProcessor , ParameterizedTypeReference <C > responseType );
203
204
204
205
}
0 commit comments