diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java index 48ca0e11..811a7885 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,11 @@ import org.springframework.core.ParameterizedTypeReference; /** * Rabbit specific methods for Amqp functionality. + * * @author Mark Pollack * @author Mark Fisher * @author Gary Russell + * @author Artem Bilan */ public interface RabbitOperations extends AmqpTemplate { @@ -52,7 +54,22 @@ public interface RabbitOperations extends AmqpTemplate { * @throws AmqpException if one occurs. * @since 2.0 */ - T invoke(OperationsCallback action) throws AmqpException; + default T invoke(OperationsCallback action) throws AmqpException { + return invoke(action, null, null); + } + + /** + * Invoke operations on the same channel. + * If callbacks are needed, both callbacks must be supplied. + * @param action the callback. + * @param acks a confirm callback for acks. + * @param nacks a confirm callback for nacks. + * @param the return type. + * @return the result of the action method. + * @since 2.1 + */ + T invoke(OperationsCallback action, com.rabbitmq.client.ConfirmCallback acks, + com.rabbitmq.client.ConfirmCallback nacks); /** * Delegate to the underlying dedicated channel to wait for confirms. The connection @@ -318,8 +335,10 @@ public interface RabbitOperations extends AmqpTemplate { * @return the response if there is one * @throws AmqpException if there is a problem */ - T convertSendAndReceiveAsType(String exchange, String routingKey, Object message, - CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException; + default T convertSendAndReceiveAsType(String exchange, String routingKey, Object message, + CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException { + return convertSendAndReceiveAsType(exchange, routingKey, message, null, correlationData, responseType); + } /** * Basic RPC pattern with conversion. Send a Java object converted to a message to a diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java index 53c084d3..ca1858ce 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java @@ -1426,12 +1426,6 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware, return convertSendAndReceiveAsType(exchange, routingKey, message, (CorrelationData) null, responseType); } - @Override - public T convertSendAndReceiveAsType(final String exchange, final String routingKey, final Object message, - CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException { - return convertSendAndReceiveAsType(exchange, routingKey, message, null, correlationData, responseType); - } - @Override public T convertSendAndReceiveAsType(final Object message, final MessagePostProcessor messagePostProcessor, ParameterizedTypeReference responseType) throws AmqpException { @@ -1848,20 +1842,6 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware, } @Override - public T invoke(OperationsCallback action) { - return invoke(action, null, null); - } - - /** - * Invoke operations on the same channel. - * If callbacks are needed, both callbacks must be supplied. - * @param action the callback. - * @param acks a confirm callback for acks. - * @param nacks a confirm callback for nacks. - * @param the return type. - * @return the result of the action method. - * @since 2.1 - */ public T invoke(OperationsCallback action, com.rabbitmq.client.ConfirmCallback acks, com.rabbitmq.client.ConfirmCallback nacks) {