Package org.springframework.jms.core
Interface JmsMessageOperations
- All Superinterfaces:
MessageReceivingOperations<Destination>
,MessageRequestReplyOperations<Destination>
,MessageSendingOperations<Destination>
- All Known Implementing Classes:
JmsMessagingTemplate
public interface JmsMessageOperations extends MessageSendingOperations<Destination>, MessageReceivingOperations<Destination>, MessageRequestReplyOperations<Destination>
A specialization ofMessageSendingOperations
,MessageReceivingOperations
andMessageRequestReplyOperations
for JMS related operations that allow to specify a destination name rather than the actualDestination
.- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
JmsTemplate
,MessageSendingOperations
,MessageReceivingOperations
,MessageRequestReplyOperations
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
convertAndSend(String destinationName, Object payload)
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the given destination.void
convertAndSend(String destinationName, Object payload, Map<String,Object> headers)
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the given destination.void
convertAndSend(String destinationName, Object payload, Map<String,Object> headers, MessagePostProcessor postProcessor)
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to the given destination.void
convertAndSend(String destinationName, Object payload, MessagePostProcessor postProcessor)
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post processor, and send the resulting message to the given destination.<T> T
convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
Convert the given request Object to serialized form, possibly using aMessageConverter
, send it as aMessage
to the given destination, receive the reply and convert its body of the specified target class.<T> T
convertSendAndReceive(String destinationName, Object request, Class<T> targetClass, MessagePostProcessor requestPostProcessor)
Convert the given request Object to serialized form, possibly using aMessageConverter
, apply the given post processor and send the resultingMessage
to the given destination, receive the reply and convert its body of the given target class.<T> T
convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass)
Convert the given request Object to serialized form, possibly using aMessageConverter
, send it as aMessage
with the given headers, to the specified destination, receive the reply and convert its body of the specified target class.<T> T
convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass, MessagePostProcessor requestPostProcessor)
Convert the given request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor and send the resultingMessage
to the specified destination, receive the reply and convert its body of the given target class.Message<?>
receive(String destinationName)
Receive a message from the given destination.<T> T
receiveAndConvert(String destinationName, Class<T> targetClass)
Receive a message from the given destination and convert its payload to the specified target class.void
send(String destinationName, Message<?> message)
Send a message to the given destination.Message<?>
sendAndReceive(String destinationName, Message<?> requestMessage)
Send a request message and receive the reply from the given destination.Methods inherited from interface org.springframework.messaging.core.MessageReceivingOperations
receive, receive, receiveAndConvert, receiveAndConvert
Methods inherited from interface org.springframework.messaging.core.MessageRequestReplyOperations
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive
Methods inherited from interface org.springframework.messaging.core.MessageSendingOperations
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
Method Detail
send
void send(String destinationName, Message<?> message) throws MessagingException
Send a message to the given destination.- Parameters:
destinationName
- the name of the target destinationmessage
- the message to send- Throws:
MessagingException
convertAndSend
void convertAndSend(String destinationName, Object payload) throws MessagingException
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message and send it to the given destination.- Parameters:
destinationName
- the name of the target destinationpayload
- the Object to use as payload- Throws:
MessagingException
convertAndSend
void convertAndSend(String destinationName, Object payload, Map<String,Object> headers) throws MessagingException
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers and send it to the given destination.- Parameters:
destinationName
- the name of the target destinationpayload
- the Object to use as payloadheaders
- the headers for the message to send- Throws:
MessagingException
convertAndSend
void convertAndSend(String destinationName, Object payload, MessagePostProcessor postProcessor) throws MessagingException
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message, apply the given post processor, and send the resulting message to the given destination.- Parameters:
destinationName
- the name of the target destinationpayload
- the Object to use as payloadpostProcessor
- the post processor to apply to the message- Throws:
MessagingException
convertAndSend
void convertAndSend(String destinationName, Object payload, @Nullable Map<String,Object> headers, @Nullable MessagePostProcessor postProcessor) throws MessagingException
Convert the given Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to the given destination.- Parameters:
destinationName
- the name of the target destinationpayload
- the Object to use as payloadheaders
- the headers for the message to sendpostProcessor
- the post processor to apply to the message- Throws:
MessagingException
receive
@Nullable Message<?> receive(String destinationName) throws MessagingException
Receive a message from the given destination.- Parameters:
destinationName
- the name of the target destination- Returns:
- the received message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
receiveAndConvert
@Nullable <T> T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException
Receive a message from the given destination and convert its payload to the specified target class.- Parameters:
destinationName
- the name of the target destinationtargetClass
- the target class to convert the payload to- Returns:
- the converted payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
sendAndReceive
@Nullable Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) throws MessagingException
Send a request message and receive the reply from the given destination.- Parameters:
destinationName
- the name of the target destinationrequestMessage
- the message to send- Returns:
- the reply, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
convertSendAndReceive
@Nullable <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass) throws MessagingException
Convert the given request Object to serialized form, possibly using aMessageConverter
, send it as aMessage
to the given destination, receive the reply and convert its body of the specified target class.- Parameters:
destinationName
- the name of the target destinationrequest
- payload for the request message to sendtargetClass
- the target type to convert the payload of the reply to- Returns:
- the payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
convertSendAndReceive
@Nullable <T> T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String,Object> headers, Class<T> targetClass) throws MessagingException
Convert the given request Object to serialized form, possibly using aMessageConverter
, send it as aMessage
with the given headers, to the specified destination, receive the reply and convert its body of the specified target class.- Parameters:
destinationName
- the name of the target destinationrequest
- payload for the request message to sendheaders
- the headers for the request message to sendtargetClass
- the target type to convert the payload of the reply to- Returns:
- the payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
convertSendAndReceive
@Nullable <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException
Convert the given request Object to serialized form, possibly using aMessageConverter
, apply the given post processor and send the resultingMessage
to the given destination, receive the reply and convert its body of the given target class.- Parameters:
destinationName
- the name of the target destinationrequest
- payload for the request message to sendtargetClass
- the target type to convert the payload of the reply torequestPostProcessor
- post process to apply to the request message- Returns:
- the payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException
convertSendAndReceive
@Nullable <T> T convertSendAndReceive(String destinationName, Object request, Map<String,Object> headers, Class<T> targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException
Convert the given request Object to serialized form, possibly using aMessageConverter
, wrap it as a message with the given headers, apply the given post processor and send the resultingMessage
to the specified destination, receive the reply and convert its body of the given target class.- Parameters:
destinationName
- the name of the target destinationrequest
- payload for the request message to sendtargetClass
- the target type to convert the payload of the reply torequestPostProcessor
- post process to apply to the request message- Returns:
- the payload of the reply message, possibly
null
if the message could not be received, for example due to a timeout - Throws:
MessagingException