`
zhangwei_david
  • 浏览: 469018 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Spring 之 JMS 发送和接收消息

    博客分类:
  • JMS
 
阅读更多

     JMS 简介:

          JMS的全称是Java Message Service,即Java消息服务。是JAVA平台中关于面向消息中间件的API.JMS提供了应用之间的异步通信机制。

   JMS优点:

  1. 异步通信;当使用JMS发送消息时,客户端不必等待消息被处理;客户端只需要将消息发送给消息代理,就可以确保消息会被发送给相应的目的地。
  2. 面向消息和解耦;使用JMS进行异步通信,客户端不要要知道目的地的地址。
  3. 确保投递

消息的传递方式有:

  1. 点对点 (Point-to-Point PTP ):一条消息只能传递给一个客户端,也就是说只要有一个客户端消费了该条消息其他客户端都无法接受到该条消息。
  2. 发布/订阅(Publish/subscribe pub/sub):一条消息可以发送给多个客户端

PTP javax.jms.Queue pub/sub javax.jms.Topic 都扩展 javax.jms.Destination 类。

 

 

消息的组成
消息传递系统的中心就是消息。一条 Message 分为三个组成部分
· 消息头 header ):是个标准字段集,客户机和供应商都用它来标识和路由消息。头信息包括:
JMSMessageID: 标识提供者发送的每一条消息 , 发送过程中由提供者设置
JMSDestination: 消息发送的 Destination, 由提供者设置
JMSDeliveryMode: 包括 DeliveryMode.PERSISTENT( 被且只被传输一次 )
DeliveryMode.NON_PERSISTENT( 最多被传输一次 )
JMSTimestamp: 提供者发送消息的时间 , 由提供者设置
JMSExpiration: 消息失效的时间 , 是发送方法的生存时间和当前时间值的和 , 0 表明消息不会过期
JMSPriority: 由提供者设置 , 0 最低 , 9 最高
JMSCorrelationID: 用来链接响应消息和请求消息 , 由发送消息的 JMS 程序设置
JMSReplyTo: 请求程序用它来指出回复消息应发送的地方
JMSType: JMS 程序用来指出消息的类型
JMSRedelivered: 消息被过早的发送给了 JMS 程序 , 程序不知道消息的接受者是谁
 
· 消息属性 property :支持把可选头字段添加到消息。如果您的应用程序需要不使用标准头字段对消息编目和分类,您就可以添加一个属性到消息以实现这个编目和分类。提供 set<Type>Property(...) get<Type>Property(...) 方法以设置和获取各种 Java 类型的属性,包括 Object JMS 定义了一个供应商选择提供的标准属性集:
JMSXUserID: 发送消息的用户的身份
JMSXAppID: 发送消息的应用程序的身份
JMSXDeliveryCount: 尝试发送消息的次数
JMSXGroupID: 该消息所属的消息组的身份
JMSXGroupSeq: 该消息在消息组中的序号
JMSXProducerTxID: 生成该消息的事物的身份
JMSXConsumerTxID: 使用该消息的事物的身份
JMSXRcvTimestamp: JMS 将消息发送给客户的时间
 
· 消息体 body ):包含要发送给接收应用程序的内容。每个消息接口特定于它所支持的内容类型。 JMS 为不同类型的内容提供了它们各自的消息类型,但是所有消息都派生自 Message 接口。消息类型有下列几种:
StreamMessage :包含 Java 基本数值流,用标准流操作来顺序的填充和读取。
MapMessage :包含一组名 / 值对;名称为 string 类型,而值为 Java 的基本类型。
TextMessage :包含一个 String
ObjectMessage :包含一个 Serializable Java 对象;能使用 JDK 的集合类。
BytesMessage :包含未解释字节流 : 编码主体以匹配现存的消息格式。
ActiveMQMapMessage {commandId = 6, responseRequired = false, messageId = ID:zhangwei-52158-1422932380502-1:2:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:zhangwei-52158-1422932380502-1:2:1:1, destination = topic://notifyTopic, transactionId = TX:ID:zhangwei-52158-1422932380502-1:2:1, expiration = 0, timestamp = 1422932388705, arrival = 0, brokerInTime = 1422932388707, brokerOutTime = 1422932388710, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@1a0c529, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false} ActiveMQMapMessage{ theTable = {} }

ActiveMQ

     ActiveMQ 是最流行的,能力强劲的开源消息总线。ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现

下载ActiveMQ

    首先去http://activemq.apache.org/download.html 下载稳定版本5.10.0

解压后目录如下:

+bin (windows下面的bat和unix/linux下面的sh)

+conf (activeMQ配置目录,包含最基本的activeMQ配置文件)

+data (默认是空的)

+docs (index,replease版本里面没有文档,-.-b不知道为啥不带)

+example (几个例子

+lib (activemMQ使用到的lib)

-apache-activemq-4.1-incubator.jar (ActiveMQ的binary)

-LICENSE.txt

-NOTICE.txt

-README.txt

-user-guide.html

启动ActiveMQ

        可以使用bin\activemq.bat(activemq) 启动

使用JMS

JMS(Java Message Service) 可以提供应用的伸缩性,可以有效地避免服务被压垮。在Java EE 平台中,为了发送和接收JMS消息,必要的步骤有如下七步:

  1. 在一个消息代理上创建一个JMS连接工厂
  2. 从JMS连接工厂中打开一个JMS连接
  3. 创建一个JMS的目的地,可以是一个消息队列也可以是一个Topic
  4. 从连接中获取一个JMS会话
  5. 用消息生产者或者消息消费者发送或接收一个消息
  6. 处理JMSException
  7. 关闭JMS会话和连接
public class ProducerTool {   
	  
    private String user = ActiveMQConnection.DEFAULT_USER;   
  
    private String password = ActiveMQConnection.DEFAULT_PASSWORD;   
  
    private String url = ActiveMQConnection.DEFAULT_BROKER_URL;   
  
    private String subject = "TOOL.DEFAULT";   
  
    private Destination destination = null;   
  
    private Connection connection = null;   
  
    private Session session = null;   
  
    private MessageProducer producer = null;   
  
    // 初始化   
    private void initialize() throws JMSException, Exception {   
    	// 1创建 factory
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(   
                user, password, url);   
        // 2、创建factory
        connection = connectionFactory.createConnection();   
        // 3、创建session
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);   
        // 4.创建目的地
        destination = session.createQueue(subject);   
        // 5.创建消息消生产者
        producer = session.createProducer(destination);   
        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);   
    }   
  
    /**
     * 将传入的String 以TextMessage 格式发送出去
     * @param message
     * @throws JMSException
     * @throws Exception
     */
    public void produceMessage(String message) throws JMSException, Exception {   
        initialize();   
        // 创建文本消息
        TextMessage msg = session.createTextMessage(message);   
        // 打开连接
        connection.start();  
        // 发送消息
        producer.send(msg);   
    }   
  
    // 关闭连接  
    public void close() throws JMSException {   
        System.out.println("Producer:->Closing connection");   
        if (producer != null)   
            producer.close();   
        if (session != null)   
            session.close();   
        if (connection != null)   
            connection.close();   
    }   

 监听JMS

public class ConsumerTool implements MessageListener {
/**
 * JSM 用户
 */
	private String user = ActiveMQConnection.DEFAULT_USER;
	/**
	 * JSM 用户密码
	 */

	private String password = ActiveMQConnection.DEFAULT_PASSWORD;

	private String url = ActiveMQConnection.DEFAULT_BROKER_URL;
/**
 * JSM 主题
 */
	private String subject = "TOOL.DEFAULT";
/**
 * 目的地
 */
	private Destination destination = null;
/**
 * 连接
 */
	private Connection connection = null;
/**
 * 会话
 */
	private Session session = null;
/**
 * 消息消费者
 */
	private MessageConsumer consumer = null;

	/**
	 * 初始化方法
	 * 1、通过user ,password,url 创建 connenctionFactory
	 * 2、通过connectionFactory 创建session
	 * 3、通过session创建目的地
	 * 5、创建指定主题消息的消费者
	 * @throws JMSException
	 * @throws Exception
	 */
	private void initialize() throws JMSException, Exception {
		// 1、创建Factory
		ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
				user, password, url);
		// 2、创建 connection
		connection = connectionFactory.createConnection();
		// 3、 创建session
		session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
		// 4、创建 目的地
		destination = session.createQueue(subject);
		// 5、创建消息消费者
		consumer = session.createConsumer(destination);

	}

	/**
	 * 消费消息方法,向消息消费者添加消息到达监听器
	 * @throws JMSException
	 * @throws Exception
	 */
	public void consumeMessage() throws JMSException, Exception {
		initialize();
		connection.start();
		// 增加消息监听器
		consumer.setMessageListener(this);
	}

	/**
	 * close 关闭
	 * @throws JMSException
	 */
	public void close() throws JMSException {
		System.out.println("Consumer:->Closing connection");
		if (consumer != null)
			consumer.close();
		if (session != null)
			session.close();
		if (connection != null)
			connection.close();
	}

	/**
	 * 接收到消息:sendTo:13919306243;content:hello!
	 * 当接收到消息的处理方法。将接收到的信息按照指定格式截取组装成SMS消息发送出去。
	 */
	public void onMessage(Message message) {
		try {
			if (message instanceof TextMessage) {
				TextMessage txtMsg = (TextMessage) message;
				String msg = txtMsg.getText();
				String[] msgs = FileUtil.splitMessage(msg);
				try {
					if (null != msgs && !msgs[1].equals("")) {
						for (String s : FileUtil.buildContent(msgs[1])) {
							SMSSender.getInstance().send(
									new OutboundMessage(msgs[0], s));
						}
					}
				} catch (GatewayException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			} else {
				System.out.println("Consumer:->Received: " + message);
			}
		} catch (JMSException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

 

可以发现实现一个简单的发送消息需要许多编码。Spring提供了一个基于模板的的解决方案,用于简化JMS消息实现的代码

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.cathy</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>demo</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<spring.version>3.1.4.RELEASE</spring.version>
		<cxf.version>2.3.0</cxf.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.7</version>
		</dependency>
		<!-- activeMq -->
		<dependency>
    		<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-all</artifactId>
    		<version>5.10.0</version>
		</dependency>
		<!-- spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context-support</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jms</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId> org.aspectj</groupId>
			<artifactId> aspectjweaver</artifactId>
			<version> 1.6.11</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>
		<dependency>
			<groupId>commons-pool</groupId>
			<artifactId>commons-pool</artifactId>
			<version>1.6</version>
		</dependency>
		<dependency>
			<groupId>dom4j</groupId>
			<artifactId>dom4j</artifactId>
			<version>1.6.1</version>
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib-nodep</artifactId>
			<version>3.1</version>
		</dependency>
		<dependency>
			<groupId>com.sun.jdmk</groupId>
			<artifactId>jmxtools</artifactId>
			<version>1.2.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
			<version>2.0.2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.0.2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxws</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxrs</artifactId>
			<version>${cxf.version}</version>
		</dependency>

		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http-jetty</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-bindings-xml</artifactId>
			<version>${cxf.version}</version>
		</dependency>
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>javax.ws.rs-api</artifactId>
			<version>2.0</version>
		</dependency>
		<dependency>
			<groupId>javax.xml.ws</groupId>
			<artifactId>jaxws-api</artifactId>
			<version>2.2.11</version>
		</dependency>
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
			<version>1.1.1</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
	</dependencies>
</project>

 

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
	xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
		http://www.springframework.org/schema/jee 
		http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
		http://www.springframework.org/schema/task  
        http://www.springframework.org/schema/task/spring-task-3.1.xsd  
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd
		">
	<aop:aspectj-autoproxy />

	<context:annotation-config />
	<context:component-scan base-package="com.cathy.demo.jms.*" />
	<!-- connectionFactory -->
	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL" value="tcp://localhost:61616"/>
	</bean>
	<!-- jmsTemplate -->
	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="connectionFactory"/>
		<property name="defaultDestination" ref="destination"/>
		<property name="receiveTimeout" value="60000"/>
	</bean>
	<!-- 队列目的地 -->
	<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
		<constructor-arg value="message.queue"/>
	</bean>
	<!-- 主题 -->
	<bean id="topic" class="org.apache.activemq.command.ActiveMQTopic">
		<constructor-arg index="0" value="notifyTopic"/>
	</bean>

</beans>

   创建一个消息发送者,jmsTemplate 中可以设置默认的destination,如果发送的地址固定此处的属性可以省略,直接使用默认地址。

/**
 *
 * @author zhangwei_david
 * @version $Id: ProducerImpl.java, v 0.1 2015年1月31日 下午8:25:36 zhangwei_david Exp $
 */
@Component
public class ProducerImpl implements Producer {
    @Autowired
    private JmsTemplate jmsTemplate;

    @Autowired
    private Destination destination;

    /**
     */
    public void send() {
        jmsTemplate.send(destination, new MessageCreator() {

            public Message createMessage(Session session) throws JMSException {
                MapMessage mapMessage = session.createMapMessage();
                mapMessage.setString("key", "test");
                return mapMessage;
            }
        });

    }
}

 同步接收消息,receive()方法会一直阻塞到消息到达为止

/**
 *
 * @author zhangwei_david
 * @version $Id: ReceiverImpl.java, v 0.1 2015年1月31日 下午8:53:49 zhangwei_david Exp $
 */
@Component
public class ReceiverImpl implements Receiver {

    @Autowired
    private JmsTemplate jmsTemplate;

    @Autowired
    private Destination destination;

    /**
     * @see com.cathy.demo.jms.receiver.Receiver#receive()
     */
    public void receive() {
        MapMessage mapMessage = (MapMessage) jmsTemplate.receive(destination);
        if (mapMessage != null) {
            System.out.println(mapMessage);
        }
    }
}

 

/**
 *
 * @author zhangwei_david
 * @version $Id: Sender.java, v 0.1 2015年1月31日 下午8:47:18 zhangwei_david Exp $
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:META-INF/spring/jms-beans.xml")
public class Sender {
    @Autowired
    private Producer producer;

    @Autowired
    private Receiver receiver;

    @Test
    public void testSend() {
        producer.send();
    }

    @Test
    public void testReceive() {
        receiver.receive();
    }
}

 

2
2
分享到:
评论
4 楼 zhangwei_david 2015-02-03  
lianglaiyang 写道
能否把import发出来?

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

使用到的jar 有 Spring-jms  activemq-all  javax-jms
3 楼 lianglaiyang 2015-02-03  
能否把import发出来?
2 楼 zhangwei_david 2015-02-02  
string2020 写道
楼主一般用JMS干什么?


一般是降低两个系统的耦合度,比如一个系统处理成功,需要记账,只需发送一个消息,消费记录中心监听这个消息就可以了。使用的场景还是很多的,主要就是系统间的集成!
1 楼 string2020 2015-02-02  
楼主一般用JMS干什么?

相关推荐

    Spring发送接收JMS消息

    Spring发送接收JMS消息 文档+例子

    weblogic中使用JMS发送和接受消息

    weblogic中使用JMS发送和接受消息(Queue and TOPIC)

    spring-jms-4.1.4.RELEASE.jar

    spring-jms-4.1.4,Spring提供的JMS工具类,它发送、接收消息

    Spring JMS异步发收消息 ActiveMQ

    JMS为JAVA开发者提供了一个与消息中介进行交互,以及发送和接收消息的标准API,而且每一个消息中介的实现都会支持JMS。(即JMS为所有消息中介提供了统一接口);JmsTemplate是Spring消除冗长和重复JMS代码的解决方案...

    spring整合jms+activemq

    spring3.0整合了activemQ和jms可以发送信息和接收消息

    Spring+JMS+ActiveMQ+Tomcat实现消息服务的demo

    基于Spring+JMS+ActiveMQ+Tomcat,我使用的版本情况如下所示:Spring ...本例通过详细的说明和注释,实现消息服务的基本功能:发送与接收。Spring对JMS提供了很好的支持,可以通过JmsTemplate来方便地实现消息服务。

    springjms的demo

    Spring对JMS提供了很好的支持,可以通过JmsTemplate来方便地实现消息服务。本例通过activeMQ服务器模拟了消息的发送与接收。需要注意的是,activeMQ的运行依赖jdk的环境,而且对jdk的版本也有要求,我用的是jdk1.6+...

    Spring In Action 使用Spring发送和接收JMS消息

    NULL 博文链接:https://wujiu.iteye.com/blog/2010643

    Spring 实现远程访问详解——jms和activemq

    把它应用到实际的业务需求中的话我们可以在特定的时候利用生产者生成一消息,并进行发送,对应的消费者在接收到对应的消息后去完成对应的业务逻辑。 JMS 支持两种消息传递模型: 点对点(point-to-point,简称 PTP)...

    Spring+JMS+ActiveMQ+Tomcat实现消息服务_服务器应用

    下面通过学习与配置,实现消息服务的基本功能:发送与接收。Spring对JMS提供了很好的支持,可以通过JmsTemplate来方便地实现消息服务。这里,我们的消息服务不涉及事务管理。下面简单说明实例。

    batch:Spring JMS with ActiveMQ – 发送和接收消息示例

    Spring JMS with ActiveMQ – 发送和接收消息示例。 此代码假装是将 ActiveMQ 与 JMS Spring Beans 一起使用的简单概念证明。 这个想法是查找 Spring 上下文来处理 JMS bean。 配置 您需要配置一个名为 BATCH_CONF ...

    使用SpringJMS轻松实现异步消息传递

    传统的使用JMSAPI进行消息传递的实现包括多个步骤,例如JNDI查询队列连接工厂和Queue资源,在实际发送和接收消息前创建一个JMS会话。Spring框架则简化了使用JEE组件(包括JMS)的任务。它提供的模板机制隐藏了典型的...

    JMS入门Demo

    该属性值默认为false,这样JMS在进行消息监听的时候就会进行事务控制,当在接收消息时监听器执行失败时JMS就会对接收到的消息进行回滚, 对于SessionAwareMessageListener在接收到消息后发送一个返回消息时也处于...

    jboss服务器下的jms实例

    基于jboss下的jms通讯,使用spring实现jms发送与接收功能文章有相关的配置

    spring-jms:带有 ActiveMQ 的 spring-jms

    这是一个简单的Spring JMS template例子,通过ActiveMQ中转消息,实现了发送和接收消息的基本功能 测试方法: 1:下载 ActiveMQ,并启动 2: 分别运行MessageReciver和MessageSender

    Spring集成ActiveMQ配置

    Spring集成ActiveMQ配置,本文是将Spring集成ActiveMQ来发送和接收JMS消息。

    Spring 2.0 开发参考手册

    19.3. 发送一条消息 19.3.1. 使用消息转换器 19.3.2. SessionCallback 和ProducerCallback 19.4. 接收消息 19.4.1. 同步接收 19.4.2. 异步接收 - 消息驱动的POJOs 19.4.3. SessionAwareMessageListener 接口 ...

    springCloud

    Spring Cloud简介 Spring Cloud包含了多个子项目(针对分布式系统中涉及的多个不同开源产品),比如:Spring Cloud Config、Spring Cloud Netflix、Spring Cloud0 CloudFoundry、Spring Cloud AWS、Spring Cloud ...

Global site tag (gtag.js) - Google Analytics