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

io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.core.RabbitMessageOperations Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2002-2014 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
 *
 *      http://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 io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.core;

import java.util.Map;

import io.bitsensor.plugins.shaded.org.springframework.messaging.Message;
import io.bitsensor.plugins.shaded.org.springframework.messaging.MessagingException;
import io.bitsensor.plugins.shaded.org.springframework.messaging.core.MessagePostProcessor;
import io.bitsensor.plugins.shaded.org.springframework.messaging.core.MessageReceivingOperations;
import io.bitsensor.plugins.shaded.org.springframework.messaging.core.MessageRequestReplyOperations;
import io.bitsensor.plugins.shaded.org.springframework.messaging.core.MessageSendingOperations;

/**
 * A specialization of {@link MessageSendingOperations} and {@link MessageRequestReplyOperations}
 * for AMQP related operations that allow to specify not only the exchange but also the
 * routing key to use.
 *
 * @author Stephane Nicoll
 * @since 1.4
 * @see io.bitsensor.plugins.shaded.io.bitsensor.plugins.shaded.org.springframework.amqp.rabbit.core.RabbitTemplate
 */
public interface RabbitMessageOperations extends MessageSendingOperations,
		MessageReceivingOperations, MessageRequestReplyOperations {

	/**
	 * Send a message to a specific exchange with a specific routing key.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param message the message to send
	 */
	void send(String exchange, String routingKey, Message message) throws MessagingException;

	/**
	 * Convert the given Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * wrap it as a message and send it to a specific exchange with a
	 * specific routing key.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param payload the Object to use as payload
	 */
	void convertAndSend(String exchange, String routingKey, Object payload) throws MessagingException;

	/**
	 * Convert the given Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * wrap it as a message with the given headers and send it to a
	 * specific exchange with a specific routing key.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param payload the Object to use as payload
	 * @param headers headers for the message to send
	 */
	void convertAndSend(String exchange, String routingKey, Object payload, Map headers)
			throws MessagingException;

	/**
	 * Convert the given Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * wrap it as a message, apply the given post processor, and send
	 * the resulting message to a specific exchange with a specific
	 * routing key.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param payload the Object to use as payload
	 * @param postProcessor the post processor to apply to the message
	 */
	void convertAndSend(String exchange, String routingKey, Object payload, MessagePostProcessor postProcessor)
			throws MessagingException;

	/**
	 * Convert the given Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * wrap it as a message with the given headers, apply the given post processor,
	 * and send the resulting message to a specific exchange with a specific
	 * routing key.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param payload the Object to use as payload
	 * @param headers headers for the message to send
	 * @param postProcessor the post processor to apply to the message
	 */
	void convertAndSend(String exchange, String routingKey, Object payload, Map headers, MessagePostProcessor postProcessor) throws MessagingException;

	/**
	 * Send a request message to a specific exchange with a specific routing key and
	 * wait for the reply
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param requestMessage the message to send
	 * @return the reply, possibly {@code null} if the message could not be received,
	 * for example due to a timeout
	 */
	Message sendAndReceive(String exchange, String routingKey, Message requestMessage) throws MessagingException;

	/**
	 * Convert the given request Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter}, send
	 * it as a {@link Message} to a specific exchange with a specific routing key,
	 * receive the reply and convert its body of the specified target class.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param request payload for the request message to send
	 * @param targetClass the target type to convert the payload of the reply to
	 * @param  return type
	 * @return the payload of the reply message, possibly {@code null} if the message
	 * could not be received, for example due to a timeout
	 */
	 T convertSendAndReceive(String exchange, String routingKey, Object request, Class targetClass)
			throws MessagingException;

	/**
	 * Convert the given request Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter}, send
	 * it as a {@link Message} with the given headers, to a specific exchange
	 * with a specific routing key, receive the reply and convert its body of
	 * the specified target class.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param request payload for the request message to send
	 * @param headers headers for the request message to send
	 * @param targetClass the target type to convert the payload of the reply to
	 * @param  return type
	 * @return the payload of the reply message, possibly {@code null} if the message
	 * could not be received, for example due to a timeout
	 */
	 T convertSendAndReceive(String exchange, String routingKey, Object request, Map headers,
			Class targetClass) throws MessagingException;

	/**
	 * Convert the given request Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * apply the given post processor and send the resulting {@link Message} to
	 * a specific exchange with a specific routing key, receive the reply and
	 * convert its body of the given target class.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param request payload for the request message to send
	 * @param targetClass the target type to convert the payload of the reply to
	 * @param requestPostProcessor post process to apply to the request message
	 * @param  return type
	 * @return the payload of the reply message, possibly {@code null} if the message
	 * could not be received, for example due to a timeout
	 */
	 T convertSendAndReceive(String exchange, String routingKey, Object request, Class targetClass,
			MessagePostProcessor requestPostProcessor) throws MessagingException;

	/**
	 * Convert the given request Object to serialized form, possibly using a
	 * {@link io.bitsensor.plugins.shaded.org.springframework.messaging.converter.MessageConverter},
	 * wrap it as a message with the given headers, apply the given post processor
	 * and send the resulting {@link Message} to a specific exchange with a
	 * specific routing key,, receive  the reply and convert its body of the
	 * given target class.
	 * @param exchange the name of the exchange
	 * @param routingKey the routing key
	 * @param request payload for the request message to send
	 * @param headers headers for the message to send
	 * @param targetClass the target type to convert the payload of the reply to
	 * @param requestPostProcessor post process to apply to the request message
	 * @param  return type
	 * @return the payload of the reply message, possibly {@code null} if the message
	 * could not be received, for example due to a timeout
	 */
	 T convertSendAndReceive(String exchange, String routingKey, Object request, Map headers,
			Class targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy