标签:
// send - 发送一个消息,使用消息创建接口MessageCreator
public void send(MessageCreator messageCreator)
public void send(final Destination destination, final MessageCreator messageCreator)
public void send(final String destinationName, final MessageCreator messageCreator)
// sendAndReceive - 发送并接收消息
public Message sendAndReceive(MessageCreator messageCreator)
public Message sendAndReceive(final Destination destination, final MessageCreator messageCreator)
public Message sendAndReceive(final String destinationName, final MessageCreator messageCreator)
// convertAndSend - 使用MessageConverter接口转换消息,先将对象转换成消息再发送消息。与之对应的是receiveAndConvert方法
public void convertAndSend(Object message) throws JmsException
public void convertAndSend(Destination destination, final Object message)
public void convertAndSend(String destinationName, final Object message)
public void convertAndSend(Object message, MessagePostProcessor postProcessor)
public void convertAndSend(Destination destination, final Object message, final MessagePostProcessor postProcessor)
public void convertAndSend(String destinationName, final Object message, final MessagePostProcessor postProcessor)
// receive - 接收消息
public Message receive()
public Message receive(Destination destination)
public Message receive(String destinationName)
// receiveSelected - 接收消息,并过滤消息
public Message receiveSelected(String messageSelector)
public Message receiveSelected(final Destination destination, final String messageSelector)
public Message receiveSelected(final String destinationName, final String messageSelector)
// receiveAndConvert - 接收消息,并使用MessageConverter接口转换消息,把一个消息转换成一个对象
public Object receiveAndConvert()
public Object receiveAndConvert(Destination destination)
public Object receiveAndConvert(String destinationName)
// receiveSelectedAndConvert - 接收消息,并使用消息过滤和消息转换
public Object receiveSelectedAndConvert(String messageSelector)
public Object receiveSelectedAndConvert(Destination destination, String messageSelector)
public Object receiveSelectedAndConvert(String destinationName, String messageSelector)
// browse - 浏览消息
public <T> T browse(BrowserCallback<T> action)
public <T> T browse(Queue queue, BrowserCallback<T> action)
public <T> T browse(String queueName, BrowserCallback<T> action)
// browseSelected - 浏览消息,并使用过滤
public <T> T browseSelected(String messageSelector, BrowserCallback<T> action)
public <T> T browseSelected(final Queue queue, final String messageSelector, final BrowserCallback<T> action)
public <T> T browseSelected(final String queueName, final String messageSelector, final BrowserCallback<T> action)
// execute - 执行SessionCallback、ProducerCallback、BrowserCallback回调接口,并得到回调接口返回值
public <T> T execute(SessionCallback<T> action)
public <T> T execute(SessionCallback<T> action, boolean startConnection)
public <T> T execute(ProducerCallback<T> action)
public <T> T execute(final Destination destination, final ProducerCallback<T> action)
public <T> T execute(final Destination destination, final ProducerCallback<T> action)
<!-- 消息侦听器 -->
<bean id="messageListener" class="jmsexample.ExampleListener" />
<!-- 消息侦听器容器 -->
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/><!-- 设置监听的队列或主题 -->
<property name="messageListener" ref="messageListener" /><!-- 设置监听器 -->
</bean>
标签:
原文地址:http://www.cnblogs.com/LiZhiW/p/4972309.html