1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 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.
26
26
27
27
/**
28
28
* Rabbit specific methods for Amqp functionality.
29
+ *
29
30
* @author Mark Pollack
30
31
* @author Mark Fisher
31
32
* @author Gary Russell
33
+ * @author Artem Bilan
32
34
*/
33
35
public interface RabbitOperations extends AmqpTemplate {
34
36
@@ -52,7 +54,22 @@ public interface RabbitOperations extends AmqpTemplate {
52
54
* @throws AmqpException if one occurs.
53
55
* @since 2.0
54
56
*/
55
- <T > T invoke (OperationsCallback <T > action ) throws AmqpException ;
57
+ default <T > T invoke (OperationsCallback <T > action ) throws AmqpException {
58
+ return invoke (action , null , null );
59
+ }
60
+
61
+ /**
62
+ * Invoke operations on the same channel.
63
+ * If callbacks are needed, both callbacks must be supplied.
64
+ * @param action the callback.
65
+ * @param acks a confirm callback for acks.
66
+ * @param nacks a confirm callback for nacks.
67
+ * @param <T> the return type.
68
+ * @return the result of the action method.
69
+ * @since 2.1
70
+ */
71
+ <T > T invoke (OperationsCallback <T > action , com .rabbitmq .client .ConfirmCallback acks ,
72
+ com .rabbitmq .client .ConfirmCallback nacks );
56
73
57
74
/**
58
75
* Delegate to the underlying dedicated channel to wait for confirms. The connection
@@ -318,8 +335,10 @@ <T> T convertSendAndReceiveAsType(String routingKey, Object message, Correlation
318
335
* @return the response if there is one
319
336
* @throws AmqpException if there is a problem
320
337
*/
321
- <T > T convertSendAndReceiveAsType (String exchange , String routingKey , Object message ,
322
- CorrelationData correlationData , ParameterizedTypeReference <T > responseType ) throws AmqpException ;
338
+ default <T > T convertSendAndReceiveAsType (String exchange , String routingKey , Object message ,
339
+ CorrelationData correlationData , ParameterizedTypeReference <T > responseType ) throws AmqpException {
340
+ return convertSendAndReceiveAsType (exchange , routingKey , message , null , correlationData , responseType );
341
+ }
323
342
324
343
/**
325
344
* Basic RPC pattern with conversion. Send a Java object converted to a message to a
0 commit comments