Top Description Inners Fields Constructors Methods
org.springframework.jms.core

public Class JmsMessagingTemplate

extends AbstractMessagingTemplate<Destination>
implements JmsMessageOperations, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.jms.core.JmsMessageOperations, org.springframework.messaging.core.MessageRequestReplyOperations, org.springframework.messaging.core.MessageReceivingOperations, org.springframework.messaging.core.MessageSendingOperations
Imports
java.util.Map, jakarta.jms.ConnectionFactory, .Destination, .JMSException, .Session, org.springframework.beans.factory.InitializingBean, org.springframework.jms.InvalidDestinationException, .JmsException, org.springframework.jms.support.converter.MessageConverter, .MessagingMessageConverter, .SimpleMessageConverter, org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessagingException, org.springframework.messaging.converter.MessageConversionException, org.springframework.messaging.core.AbstractMessagingTemplate, .DestinationResolutionException, .MessagePostProcessor, org.springframework.util.Assert

An implementation of JmsMessageOperations.
Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private boolean
private String
private MessageConverter
private JmsTemplate

Constructor Summary

AccessConstructor and Description
public
JmsMessagingTemplate()

Constructor for use with bean properties.

public
JmsMessagingTemplate(ConnectionFactory connectionFactory)

Create a JmsMessagingTemplate instance with the JMS ConnectionFactory to use, implicitly building a JmsTemplate based on it.

public
JmsMessagingTemplate(JmsTemplate jmsTemplate)

Create a JmsMessagingTemplate instance with the JmsTemplate to use.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public void
convertAndSend(Object
the Object to use as payload
payload
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message and send it to a default destination.

public void
convertAndSend(Object
the Object to use as payload
payload
,
MessagePostProcessor
the post processor to apply to the message
postProcessor
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message, apply the given post processor, and send the resulting message to a default destination.

public void
convertAndSend(String
the name of the target destination
destinationName
,
Object
the Object to use as payload
payload
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.jms.core.JmsMessageOperations.convertAndSend, org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message and send it to the given destination.

public void
convertAndSend(String
the name of the target destination
destinationName
,
Object
the Object to use as payload
payload
,
Map<String, Object>
the headers for the message to send
headers
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.jms.core.JmsMessageOperations.convertAndSend, org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message with the given headers and send it to the given destination.

public void
convertAndSend(String
the name of the target destination
destinationName
,
Object
the Object to use as payload
payload
,
MessagePostProcessor
the post processor to apply to the message
postProcessor
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.jms.core.JmsMessageOperations.convertAndSend, org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, wrap it as a message, apply the given post processor, and send the resulting message to the given destination.

public void
convertAndSend(String
the name of the target destination
destinationName
,
Object
the Object to use as payload
payload
,
Map<String, Object>
the headers for the message to send
headers
,
MessagePostProcessor
the post processor to apply to the message
postProcessor
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend.

Implements org.springframework.jms.core.JmsMessageOperations.convertAndSend, org.springframework.messaging.core.MessageSendingOperations.convertAndSend.

Convert the given Object to serialized form, possibly using a 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 the given destination.

protected MessagingException
protected Message<?>
public <T> T
convertSendAndReceive(String
the name of the target destination
destinationName
,
Object
payload for the request message to send
request
,
Class<T>
the target type to convert the payload of the reply to
targetClass
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.jms.core.JmsMessageOperations.convertSendAndReceive, org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, send it as a Message to the given destination, receive the reply and convert its body of the specified target class.

public <T> T
convertSendAndReceive(Object
payload for the request message to send
request
,
Class<T>
the target type to convert the payload of the reply to
targetClass
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, send it as a Message to a default destination, receive the reply and convert its body of the specified target class.

public <T> T
convertSendAndReceive(String
the name of the target destination
destinationName
,
Object
payload for the request message to send
request
,
Map<String, Object>
the headers for the request message to send
headers
,
Class<T>
the target type to convert the payload of the reply to
targetClass
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.jms.core.JmsMessageOperations.convertSendAndReceive, org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, send it as a Message with the given headers, to the specified destination, receive the reply and convert its body of the specified target class.

public <T> T
convertSendAndReceive(Object
payload for the request message to send
request
,
Class<T>
the target type to convert the payload of the reply to
targetClass
,
MessagePostProcessor
post process to apply to the request message
postProcessor
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, apply the given post processor and send the resulting Message to a default destination, receive the reply and convert its body of the given target class.

public <T> T
convertSendAndReceive(String
the name of the target destination
destinationName
,
Object
payload for the request message to send
request
,
Class<T>
the target type to convert the payload of the reply to
targetClass
,
MessagePostProcessor
post process to apply to the request message
requestPostProcessor
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.jms.core.JmsMessageOperations.convertSendAndReceive, org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a org.springframework.messaging.converter.MessageConverter, apply the given post processor and send the resulting Message to the given destination, receive the reply and convert its body of the given target class.

public <T> T
convertSendAndReceive(String
the name of the target destination
destinationName
,
Object
payload for the request message to send
request
,
Map<String, Object> headers, Class<T>
the target type to convert the payload of the reply to
targetClass
,
MessagePostProcessor
post process to apply to the request message
postProcessor
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.convertSendAndReceive.

Implements org.springframework.jms.core.JmsMessageOperations.convertSendAndReceive, org.springframework.messaging.core.MessageRequestReplyOperations.convertSendAndReceive.

Convert the given request Object to serialized form, possibly using a 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 the specified destination, receive the reply and convert its body of the given target class.

private JmsMessagingTemplate.MessagingMessageCreator
protected Message<?>
doReceive(Destination
the target destination
destination
)

Implements abstract org.springframework.messaging.core.AbstractMessageReceivingTemplate.doReceive.

Actually receive a message from the given destination.

protected Message<?>
doReceive(String
the target destination
destinationName
)

Implements abstract org.springframework.messaging.core.AbstractMessageReceivingTemplate.doReceive.

Actually receive a message from the given destination.

protected void
protected void
protected Message<?>
protected Message<?>
public ConnectionFactory
getConnectionFactory()

Return the ConnectionFactory that the underlying JmsTemplate uses.

public String
getDefaultDestinationName()

Return the configured default destination name.

public MessageConverter
getJmsMessageConverter()

Return the MessageConverter to use to convert a Message from the messaging to and from a jakarta.jms.Message.

public JmsTemplate
getJmsTemplate()

Return the configured JmsTemplate.

protected String
private JmsTemplate
public Message<?>
public Message<?>
public <T> T
receiveAndConvert(Class<T>
the target class to convert the payload to
targetClass
)

Overrides org.springframework.messaging.core.AbstractMessageReceivingTemplate.receiveAndConvert.

Implements org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from a default destination and convert its payload to the specified target class.

public <T> T
receiveAndConvert(String
the name of the target destination
destinationName
,
Class<T>
the target class to convert the payload to
targetClass
)

Overrides org.springframework.messaging.core.AbstractMessageReceivingTemplate.receiveAndConvert.

Implements org.springframework.jms.core.JmsMessageOperations.receiveAndConvert, org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from the given destination and convert its payload to the specified target class.

public void
send(Message<?>
the message to send
message
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.send.

Implements org.springframework.messaging.core.MessageSendingOperations.send.

Send a message to a default destination.

public void
send(String
the name of the target destination
destinationName
,
Message<?>
the message to send
message
)

Overrides org.springframework.messaging.core.AbstractMessageSendingTemplate.send.

Implements org.springframework.jms.core.JmsMessageOperations.send, org.springframework.messaging.core.MessageSendingOperations.send.

Send a message to the given destination.

public Message<?>
sendAndReceive(Message<?>
the message to send
requestMessage
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive.

Implements org.springframework.messaging.core.MessageRequestReplyOperations.sendAndReceive.

Send a request message and receive the reply from a default destination.

public Message<?>
sendAndReceive(String
the name of the target destination
destinationName
,
Message<?>
the message to send
requestMessage
)

Overrides org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive.

Implements org.springframework.jms.core.JmsMessageOperations.sendAndReceive, org.springframework.messaging.core.MessageRequestReplyOperations.sendAndReceive.

Send a request message and receive the reply from the given destination.

public void
setConnectionFactory(ConnectionFactory connectionFactory)

Set the ConnectionFactory to use for the underlying JmsTemplate.

public void
setDefaultDestinationName(String defaultDestinationName)

Configure the default destination name to use in send methods that don't have a destination argument.

public void
setJmsMessageConverter(MessageConverter jmsMessageConverter)

Set the MessageConverter to use to convert a Message from the messaging to and from a jakarta.jms.Message.

public void
setJmsTemplate(JmsTemplate jmsTemplate)

Set the JmsTemplate to use.