异步消息总线hornetq学习-01基于maven的客户端程序框架搭建

hornetq是一个高性能的,支持集群配置的异步消息系统,完全支持jms,项目中使用hornetq作为异步消息服务器来使用,靠jms来进行系统间消息传递

项目中使用的hornetq的版本是2.3.0.Final,该软件的安装非常简单,直接解压即可,运行bin目录中的run.sh脚本启动服务(默认是非集群配置,standalong模式)

因为项目中使用maven作为项目管理工具,而hornetq默认带的example都是以ant作为构建工具的,因此,在找hornetq的客户端依赖时花了些时间,记录以下便于后期查找

根据hornetq的文档说明,其设计非常优雅,很少依赖第三方的其他组件,因此客户端的依赖也只有一下几个

hornetq-core-client -这个是client的核心

hornetq-jms-client -如果我们打算用hornetq的jms消息(hornetq中jms不是必须的组件)

netty-类似nio的东东,hornetq利用该机制分别装客户端与网络间的复杂操作,并且有很高的性能

spring-xxx,这个很容易理解,就是spring对jms的封装模板类

看一下一个完整的maven pom文件的定义

<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.crazycoder2010</groupId>
	<artifactId>hornetq</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

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

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<spring.version>3.2.4.RELEASE</spring.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
		<!-- jnp-client包只有在通过jndi方式连接hornetq时候添加 -->
		<dependency>
			<groupId>jboss</groupId>
			<artifactId>jnp-client</artifactId>
			<version>4.2.2.GA</version>
		</dependency>
		<dependency>
			<groupId>org.hornetq</groupId>
			<artifactId>hornetq-jms-client</artifactId>
			<version>2.3.0.Final</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jms</artifactId>
			<version>${spring.version}</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


这样一个项目的结构就搭建起来了,如图在eclipse中可以看到项目中添加的各个jar包




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值