All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.amqp.core.AsyncAmqpTemplate Maven / Gradle / Ivy

There is a newer version: 3.1.6
Show newest version
/*
 * Copyright 2020-2022 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.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.amqp.core;

import java.util.concurrent.CompletableFuture;

import org.springframework.core.ParameterizedTypeReference;

/**
 * Classes implementing this interface can perform asynchronous send and
 * receive operations using {@link CompletableFuture}s.
 *
 * @author Gary Russell
 * @since 2.0
 *
 */
public interface AsyncAmqpTemplate {

	/**
	 * Send a message to the default exchange with the default routing key. If the message
	 * contains a correlationId property, it must be unique.
	 * @param message the message.
	 * @return the {@link CompletableFuture}.
	 */
	CompletableFuture sendAndReceive(Message message);

	/**
	 * Send a message to the default exchange with the supplied routing key. If the message
	 * contains a correlationId property, it must be unique.
	 * @param routingKey the routing key.
	 * @param message the message.
	 * @return the {@link CompletableFuture}.
	 */
	CompletableFuture sendAndReceive(String routingKey, Message message);

	/**
	 * Send a message to the supplied exchange and routing key. If the message
	 * contains a correlationId property, it must be unique.
	 * @param exchange the exchange.
	 * @param routingKey the routing key.
	 * @param message the message.
	 * @return the {@link CompletableFuture}.
	 */
	CompletableFuture sendAndReceive(String exchange, String routingKey, Message message);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * default routing key.
	 * @param object the object to convert.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(Object object);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * provided routing key.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(String routingKey, Object object);

	/**
	 * Convert the object to a message and send it to the provided exchange and
	 * routing key.
	 * @param exchange the exchange.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(String exchange, String routingKey, Object object);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * default routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(Object object, MessagePostProcessor messagePostProcessor);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * provided routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(String routingKey, Object object,
			MessagePostProcessor messagePostProcessor);

	/**
	 * Convert the object to a message and send it to the provided exchange and
	 * routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param exchange the exchange
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceive(String exchange, String routingKey, Object object,
			MessagePostProcessor messagePostProcessor);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * default routing key.
	 * @param object the object to convert.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(Object object, ParameterizedTypeReference responseType);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * provided routing key.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(String routingKey, Object object,
			ParameterizedTypeReference responseType);

	/**
	 * Convert the object to a message and send it to the provided exchange and
	 * routing key.
	 * @param exchange the exchange.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(String exchange, String routingKey, Object object,
			ParameterizedTypeReference responseType);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * default routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(Object object, MessagePostProcessor messagePostProcessor,
			ParameterizedTypeReference responseType);

	/**
	 * Convert the object to a message and send it to the default exchange with the
	 * provided routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(String routingKey, Object object,
			MessagePostProcessor messagePostProcessor, ParameterizedTypeReference responseType);

	/**
	 * Convert the object to a message and send it to the provided exchange and
	 * routing key after invoking the {@link MessagePostProcessor}.
	 * If the post processor adds a correlationId property, it must be unique.
	 * @param exchange the exchange
	 * @param routingKey the routing key.
	 * @param object the object to convert.
	 * @param messagePostProcessor the post processor.
	 * @param responseType the response type.
	 * @param  the expected result type.
	 * @return the {@link CompletableFuture}.
	 */
	 CompletableFuture convertSendAndReceiveAsType(String exchange, String routingKey, Object object,
			MessagePostProcessor messagePostProcessor, ParameterizedTypeReference responseType);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy