`

JMS之ActiveMQ Linux下安装与应用实例

    博客分类:
  • JMS
阅读更多
1.下载activeMQ安装包,拷贝到/activeMQ目录下
apache-activemq-5.10.0-bin.tar.gz,下载地址http://activemq.apache.org/download.html

2.解压文件到运行目录

[root@iZ94wmbxqzyZ softs]# tar -xzvf /server/apache-activemq-5.10.0-bin.tar.gz


3.为了方便管理,重命名
[root@iZ94wmbxqzyZ softs]# mv apache-activemq-5.10.0 activemq-5.10.0

[root@iZ94wmbxqzyZ softs]# cd activemq-5.10.0/
[root@iZ94wmbxqzyZ activemq-5.10.0]# ll
total 6304
-rwxr-xr-x 1 root root 6371237 Jun  5  2014 activemq-all-5.10.0.jar
drwxr-xr-x 5 root root    4096 Jan 11 23:31 bin
drwxr-xr-x 2 root root    4096 Jan 11 23:31 conf
drwxr-xr-x 2 root root    4096 Jan 11 23:31 data
drwxr-xr-x 2 root root    4096 Jan 11 23:31 docs
drwxr-xr-x 8 root root    4096 Jan 11 23:31 examples
drwxr-xr-x 6 root root    4096 Jan 11 23:31 lib
-rw-r--r-- 1 root root   40580 Jun  5  2014 LICENSE
-rw-r--r-- 1 root root    3334 Jun  5  2014 NOTICE
-rw-r--r-- 1 root root    2610 Jun  5  2014 README.txt
drwxr-xr-x 7 root root    4096 Jan 11 23:31 webapps
drwxr-xr-x 3 root root    4096 Jan 11 23:31 webapps-demo
[root@iZ94wmbxqzyZ activemq-5.10.0]# cd bin/
[root@iZ94wmbxqzyZ bin]# ll
total 152
-rwxr-xr-x 1 root root 22126 Jun  5  2014 activemq
-rwxr-xr-x 1 root root  5665 Jun  5  2014 activemq-admin
-rw-r--r-- 1 root root 15954 Jun  5  2014 activemq.jar
-rwxr-xr-x 1 root root  6189 Jun  5  2014 diag
drwxr-xr-x 2 root root  4096 Jan 11 23:31 linux-x86-32
drwxr-xr-x 2 root root  4096 Jan 11 23:31 linux-x86-64
drwxr-xr-x 2 root root  4096 Jan 11 23:31 macosx
-rwxr-xr-x 1 root root 83820 Jun  5  2014 wrapper.jar

4.启动服务
[root@iZ94wmbxqzyZ bin]# ./activemq start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)

INFO: Invoke the following command to create a configuration file
./activemq setup [ /etc/default/activemq | /root/.activemqrc ]

INFO: Using java '/softs/jdk1.6.0_30/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/softs/activemq-5.10.0/data/activemq-iZ94wmbxqzyZ.pid' (pid '28962')

5.查看是否启动成功
[root@iZ94wmbxqzyZ bin]# 
[root@iZ94wmbxqzyZ bin]# ps -ef | grep activemq
root     28962     1 32 23:32 pts/0    00:00:04 /softs/jdk1.6.0_30/bin/java -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/softs/activemq-5.10.0/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/softs/activemq-5.10.0/tmp -Dactivemq.classpath=/softs/activemq-5.10.0/conf; -Dactivemq.home=/softs/activemq-5.10.0 -Dactivemq.base=/softs/activemq-5.10.0 -Dactivemq.conf=/softs/activemq-5.10.0/conf -Dactivemq.data=/softs/activemq-5.10.0/data -jar /softs/activemq-5.10.0/bin/activemq.jar start
root     29011 28898  0 23:32 pts/0    00:00:00 grep activemq
[root@iZ94wmbxqzyZ bin]# 
[root@iZ94wmbxqzyZ bin]# 

6.停止服务
[root@iZ94wmbxqzyZ data]# 
[root@iZ94wmbxqzyZ data]# kill 28962
[root@iZ94wmbxqzyZ data]# 
[root@iZ94wmbxqzyZ data]# ps -ef | grep activemq
root     29078 28898  0 23:42 pts/0    00:00:00 grep activemq
[root@iZ94wmbxqzyZ data]# 



到此环境准备成功

demo应用
package com.wzh.activemq;

import java.io.Serializable;

public class User implements Serializable{

	private static final long serialVersionUID = 1L;

	private String username ;
	
	private String password ;
	
	public User(String username,String password){
		this.username = username ;
		this.password = password ;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "[username="+username+",password="+password+"]" ;
	}
	
	
	

}


----------------------------------------------------------
点对点:
生产者:
package com.wzh.activemq;

import java.io.Serializable;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;

public class P2PMessageProducer {

	protected String username = ActiveMQConnection.DEFAULT_USER;
	protected String password = ActiveMQConnection.DEFAULT_PASSWORD;
	//protected String brokerURL = "tcp://127.0.0.1:61616";
	protected String brokerURL = "tcp://120.24.85.167:61616";

	protected static transient ConnectionFactory factory;
	protected transient Connection connection;

	public static void main(String[] args) {
	
		try {
			new P2PMessageProducer().sendObjectMessage(new User("wzh","q123456"));
			new P2PMessageProducer().sendMapMessage();
			new P2PMessageProducer().sendTextMessage("海,你好");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public P2PMessageProducer() {

		try {
			factory = new ActiveMQConnectionFactory(username, password,
					brokerURL);
			connection = factory.createConnection();
			connection.start();
		} catch (JMSException jmse) {
			close();
		}
	}

	/**
	 * 初始化连接信息
	 */
	public P2PMessageProducer(String username, String password, String brokerURL)
			throws JMSException {
		this.username = username;
		this.password = password;
		this.brokerURL = brokerURL;

		factory = new ActiveMQConnectionFactory(username, password, brokerURL);
		connection = factory.createConnection();
		try {
			connection.start();
		} catch (JMSException jmse) {
			connection.close();
			throw jmse;
		}
	}

	/**
	 * 关闭连接
	 */
	public void close() {
		try {
			if (connection != null) {
				connection.close();
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	
	protected void sendObjectMessage(Serializable serializable) throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Destination destination = session.createQueue("MessageQueue");
			MessageProducer producer = session.createProducer(destination);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			Message message = session.createObjectMessage(serializable);

			producer.send(message);

			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}


	protected void sendTextMessage(String text) throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Destination destination = session.createQueue("MessageQueue");
			MessageProducer producer = session.createProducer(destination);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			Message message = session.createTextMessage(text);

			producer.send(message);
			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}
		
	protected void sendMapMessage() throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Destination destination = session.createQueue("MessageQueue");
			MessageProducer producer = session.createProducer(destination);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			MapMessage message = session.createMapMessage();
			message.setString("stock", "string");
			message.setDouble("price", 11.14);
			producer.send(message);

			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}

}



消费者:
package com.wzh.activemq;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;

public class P2PMessageConsumer {

	protected String username = ActiveMQConnection.DEFAULT_USER;
	protected String password = ActiveMQConnection.DEFAULT_PASSWORD;
	//protected String brokerURL = "tcp://127.0.0.1:61616";
	protected String brokerURL = "tcp://120.24.85.167:61616";

	protected static transient ConnectionFactory factory;
	protected transient Connection connection;

	public static void main(String[] args) {
		P2PMessageConsumer consumer = new P2PMessageConsumer();
		consumer.receiveMessage();
	}

	public P2PMessageConsumer() {

		try {
			factory = new ActiveMQConnectionFactory(username, password,
					brokerURL);
			connection = factory.createConnection();
			connection.start();
		} catch (JMSException jmse) {
			close();
		}
	}

	public P2PMessageConsumer(String username, String password, String brokerURL)
			throws JMSException {
		this.username = username;
		this.password = password;
		this.brokerURL = brokerURL;

		factory = new ActiveMQConnectionFactory(username, password, brokerURL);
		connection = factory.createConnection();
		try {
			connection.start();
		} catch (JMSException jmse) {
			connection.close();
			throw jmse;
		}
	}

	public void close() {
		try {
			if (connection != null) {
				connection.close();
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	protected void receiveMessage() {
		Session session = null;
		try {

			session = connection.createSession(Boolean.FALSE,
					Session.AUTO_ACKNOWLEDGE);
			Destination destination = session.createQueue("MessageQueue");
			MessageConsumer consumer = session.createConsumer(destination);

			while (true) {
				Message message = consumer.receive();

				if (null != message) {

					if (message instanceof ObjectMessage) {
						System.out.println("deal ObjectMessage....");
						dealObjectMessage((ObjectMessage) message);
					} else if (message instanceof MapMessage) {
						System.out.println("deal MapMessage....");
						dealMapMessage((MapMessage) message);
					} else if (message instanceof TextMessage) {
						System.out.println("deal TextMessage....");
						dealTextMessage((TextMessage) message);
					}

				} else {
					break;
				}

			}

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (session != null) {
				try {
					session.commit();
				} catch (JMSException e) {
					e.printStackTrace();
				}
			}

		}

	}

	/**
	 * 
	 * 处理 TextMessage消息
	 * 
	 * @throws JMSException
	 */
	private void dealTextMessage(TextMessage message) throws JMSException {
		String text = message.getText();
		System.out.println("text = " + text);

	}

	/**
	 * 
	 * 处理 MapMessage消息
	 * 
	 * @throws JMSException
	 */
	private void dealMapMessage(MapMessage message) throws JMSException {
		String stack = message.getString("stock");
		Double price = message.getDouble("price");
		System.out.println("stock = " + stack + " , price =" + price);
	}

	/**
	 * 处理ObjectMessage消息
	 */
	private void dealObjectMessage(ObjectMessage message) throws JMSException {

		User user = (User) message.getObject();
		System.out.println(user.toString());

	}

}



运行结果:
deal ObjectMessage....
[username=wzh,password=q123456]
deal MapMessage....
stock = string , price =11.14
deal TextMessage....
text = 海,你好



===========================================================================
发布与订阅:
-----------------------
消息发布者

package com.wzh.activemq;

import java.io.Serializable;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.Topic;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;

public class Publish {

	protected String username = ActiveMQConnection.DEFAULT_USER;
	protected String password = ActiveMQConnection.DEFAULT_PASSWORD;
	//protected String brokerURL = "tcp://127.0.0.1:61616";
	protected String brokerURL = "tcp://120.24.85.167:61616";

	protected static transient ConnectionFactory factory;
	protected transient Connection connection;

	public static void main(String[] args) {
		try {
			new Publish().sendObjectMessage(new User("wzh","q123456"));
			new Publish().sendMapMessage();
			new Publish().sendTextMessage("海,你好");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public Publish() {

		try {
			factory = new ActiveMQConnectionFactory(username, password,
					brokerURL);
			connection = factory.createConnection();
			connection.start();
		} catch (JMSException jmse) {
			close();
		}
	}

	public Publish(String username, String password, String brokerURL)
			throws JMSException {
		this.username = username;
		this.password = password;
		this.brokerURL = brokerURL;

		factory = new ActiveMQConnectionFactory(username, password, brokerURL);
		connection = factory.createConnection();
		try {
			connection.start();
		} catch (JMSException jmse) {
			connection.close();
			throw jmse;
		}
	}

	public void close() {
		try {
			if (connection != null) {
				connection.close();
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	protected void sendObjectMessage(Serializable serializable) throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Topic topic = session.createTopic("MessageTopic");
			MessageProducer producer = session.createProducer(topic);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			Message message = session.createObjectMessage(serializable);

			producer.send(message);

			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}


	protected void sendTextMessage(String text) throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Topic topic = session.createTopic("MessageTopic");
			MessageProducer producer = session.createProducer(topic);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			Message message = session.createTextMessage(text);

			producer.send(message);
			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}
		
	protected void sendMapMessage() throws JMSException {
		Session session = null;
		try {

			session = connection.createSession(Boolean.TRUE,
					Session.AUTO_ACKNOWLEDGE);
			Topic topic = session.createTopic("MessageTopic");
			MessageProducer producer = session.createProducer(topic);
			producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

			MapMessage message = session.createMapMessage();
			message.setString("stock", "string");
			message.setDouble("price", 11.14);
			producer.send(message);

			session.commit();

		} catch (JMSException e) {
			try {
				session.rollback() ;
			} catch (JMSException e1) {
				e1.printStackTrace();
			}
			throw e ;
		} finally {
			close();
		}

	}
}



消息订阅者:
package com.wzh.activemq;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;

public class Subscriber {

	protected String username = ActiveMQConnection.DEFAULT_USER;
	protected String password = ActiveMQConnection.DEFAULT_PASSWORD;
	//protected String brokerURL = "tcp://127.0.0.1:61616";
	protected String brokerURL = "tcp://120.24.85.167:61616";

	protected static transient ConnectionFactory factory;
	protected transient Connection connection;

	public static void main(String[] args) {
		Subscriber consumer = new Subscriber();
		consumer.receiveMessage();
	}

	public Subscriber() {

		try {
			factory = new ActiveMQConnectionFactory(username, password,
					brokerURL);
			connection = factory.createConnection();
			connection.start();
		} catch (JMSException jmse) {
			close();
		}
	}

	public Subscriber(String username, String password, String brokerURL)
			throws JMSException {
		this.username = username;
		this.password = password;
		this.brokerURL = brokerURL;

		factory = new ActiveMQConnectionFactory(username, password, brokerURL);
		connection = factory.createConnection();
		try {
			connection.start();
		} catch (JMSException jmse) {
			connection.close();
			throw jmse;
		}
	}

	public void close() {
		try {
			if (connection != null) {
				connection.close();
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	protected void receiveMessage() {
		Session session = null;
		try {

			session = connection.createSession(Boolean.FALSE,
					Session.AUTO_ACKNOWLEDGE);
			Topic topic = session.createTopic("MessageTopic");
			MessageConsumer consumer = session.createConsumer(topic);
			
			consumer.setMessageListener(new MessageListener() {
				
				@Override
				public void onMessage(Message message) {

					if (message instanceof ObjectMessage) {
						System.out.println("deal ObjectMessage....");
						dealObjectMessage((ObjectMessage) message);
					} else if (message instanceof MapMessage) {
						System.out.println("deal MapMessage....");
						dealMapMessage((MapMessage) message);
					} else if (message instanceof TextMessage) {
						System.out.println("deal TextMessage....");
						dealTextMessage((TextMessage) message);
					}
					
				}
			}) ; 

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			/*if (session != null) {
				try {
					session.commit();
				} catch (JMSException e) {
					e.printStackTrace();
				}
			}*/

		}

	}

	/**
	 * 
	 * 处理 TextMessage消息
	 * 
	 * @throws JMSException
	 */
	private void dealTextMessage(TextMessage message) {
		try {
			String text = message.getText();
			System.out.println("text = " + text);
		} catch (JMSException e) {
			e.printStackTrace();
		}

	}

	/**
	 * 
	 * 处理 MapMessage消息
	 * 
	 * @throws JMSException
	 */
	private void dealMapMessage(MapMessage message){
		try {
			String stack = message.getString("stock");
			Double price = message.getDouble("price");
			System.out.println("stock = " + stack + " , price =" + price);
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 处理ObjectMessage消息
	 */
	private void dealObjectMessage(ObjectMessage message){

		try {
			User user = (User) message.getObject();
			System.out.println(user.toString());
		} catch (JMSException e) {
			e.printStackTrace();
		}

	}

}




0
3
分享到:
评论
2 楼 sgq0085 2015-01-13  
写得非常详细   好文章
1 楼 強顔歓笶 2015-01-12  
 

相关推荐

    Linux下activeMQ的启动和停止.docx

    在Linux环境下,Apache ActiveMQ是一个广泛使用的开源...总的来说,管理Linux下的ActiveMQ涉及对命令行工具的熟悉以及对服务运行状态的监控。理解并熟练运用这些命令,将有助于你更有效地维护和管理你的ActiveMQ实例。

    ActiveMQ开发实例-5

    在这个开发实例中,我们将深入探讨如何使用ActiveMQ进行消息队列的构建与应用。 1. **ActiveMQ简介** - ActiveMQ作为Apache软件基金会的一个项目,是Java平台上的顶级JMS提供商,同时也支持多种协议如AMQP、STOMP...

    ActiveMQ简单的HelloWorld实例

    在安装目录下,找到`bin`文件夹,运行对应的启动脚本(Windows上是`activemq.bat`,Linux或Mac上是`bin/activemq start`)。这将启动ActiveMQ服务器,并在默认端口61616上提供服务。 2. **创建消息生产者** 创建...

    ActiveMQ开发实例-2

    安装完成后,启动ActiveMQ服务器,这通常可以通过执行bin目录下的start.bat(Windows)或bin/activemq start(Linux/Mac)脚本来完成。 **集成C++和MFC** 为了在C++中使用ActiveMQ,你需要引入ActiveMQ的C++库。这...

    activemq安装.rar

    在Linux环境下安装ActiveMQ是许多IT专业人员进行分布式系统集成时的常见任务。以下是关于如何在Linux上安装和配置ActiveMQ的详细步骤,以及相关的知识点: 1. **了解ActiveMQ**: - ActiveMQ是Apache软件基金会的...

    activemq安装与集群部署文档

    Activemq安装与集群部署文档详细介绍了ActiveMQ在Linux环境下的安装步骤、配置过程以及集群部署的相关知识。 首先,文档提到了在Linux环境下安装JDK,并配置环境变量。JDK是Java程序的运行环境,安装JDK是运行...

    ActiveMQ实例Demo

    在Java代码中,我们可以使用`javax.jms.ConnectionFactory`来建立与ActiveMQ服务器的连接,并创建`MessageProducer`对象来发送消息。例如: ```java import org.apache.activemq.ActiveMQConnectionFactory; import...

    activemq安装包与demo

    2. **创建连接**:使用 JMS API 创建与 ActiveMQ 服务器的连接,通常通过 `ConnectionFactory` 实例化。 3. **创建会话**:在连接上创建会话,用于发送和接收消息。 4. **创建目的地**:对于点对点,创建 `Queue` ...

    linux下 apache-activemq

    Apache ActiveMQ是开源的、基于Java消息服务(JMS)的应用服务器,被广泛应用于企业级分布式应用程序间的消息传递。在Linux环境下配置和使用Apache ActiveMQ,可以为你的系统提供高效、可靠的异步通信能力。本篇文章...

    apache-activemq-5.16.5

    2. **多种协议支持**:除了JMS,ActiveMQ还支持STOMP、AMQP、MQTT等多种消息协议,这使得不同平台和语言的应用可以方便地与之交互。 3. **高可用性**:通过集群和故障转移,ActiveMQ可以实现高可用性,确保消息服务...

    java消息中间件教程-activemq

    #### 三、ActiveMQ的安装与使用 - **4-1 Windows环境下安装ActiveMQ** - 在ActiveMQ官网下载Windows版本的ActiveMQ安装包。 - 下载完成后解压缩文件。 - 使用管理员权限运行`activemq.bat`文件来启动ActiveMQ...

    ActiveMQ与Spring整合示例Demo

    将ActiveMQ与Spring整合,可以方便地在Spring应用中使用消息队列,实现异步处理和分布式通信。 **一、ActiveMQ安装与配置** 在Linux系统中安装ActiveMQ,首先需要下载ActiveMQ的二进制包,解压后将其放置在合适的...

    ActiveMQ消息总线介绍

    默认情况下,只需要执行`bin/activemq`(Linux/Unix)或`bin\activemq.bat`(Windows)即可启动服务。 ##### 配置方式 - **XML配置**:ActiveMQ的核心配置文件位于`conf/activemq.xml`中,这里可以设置各种参数,...

    activemq入门实例

    本实例旨在引导初学者了解并熟悉ActiveMQ的基本概念、安装配置以及使用方法。 一、ActiveMQ概述 ActiveMQ是一个高性能、灵活且功能丰富的消息代理,支持多种消息协议,如OpenWire、STOMP、AMQP、MQTT等,使得不同...

    activeMQ点对点map消息

    2. 启动ActiveMQ服务器:进入解压后的目录,运行`bin\start.bat`(Windows)或`bin/activemq start`(Linux/Unix)命令启动服务器。 3. 创建JMS连接工厂和目的地:在ActiveMQ的配置文件(如`conf/activemq.xml`)中...

    apache-activemq-5.8.0-bin.tar.gz

    在Linux环境下,ActiveMQ通常能享受到更好的性能和稳定性,因为它利用了Linux内核的特性,如文件系统缓存和调度器。 4. **部署与运行**: - 解压:首先,使用`tar -zxvf apache-activemq-5.8.0-bin.tar.gz`命令...

    apache-activemq-5.15.3-bin.tar.gz

    这个压缩包“apache-activemq-5.15.3-bin.tar.gz”包含了Apache ActiveMQ 5.15.3版本的源代码和可执行文件,适合在Linux环境下部署和使用。 **1. Apache ActiveMQ简介** Apache ActiveMQ是Apache软件基金会的一个...

    activemq实战

    - **案例概述**:本书通过一系列实例来展示如何使用ActiveMQ构建各种应用场景下的消息传递系统。 - **目的**:通过实际案例帮助读者深入了解ActiveMQ的核心概念和技术细节,并学会如何在真实环境中部署和管理...

    apache-activemq-5.16.6-bin.zip

    1. **启动服务器**: 执行bin目录下的start.bat(Windows)或start.sh(Linux/Mac)脚本启动ActiveMQ。 2. **配置**: 修改conf目录下的activemq.xml文件以定制你的消息代理设置。 3. **创建消息生产者和消费者**: ...

Global site tag (gtag.js) - Google Analytics