ActiveMQ是什么
ActiveMQ是Apache出品,最流行的,能力强劲的开源消息总线。
ActiveMQ是一个完全支持JMS1.1和J2EE1.4规范的JMS Provider实现,尽管JMS规范出台已经是很久的事情了,但是JMS在当今的J2EE应用中任然扮演着特殊的地位。
JMS规范
Java消息服务(Java Message Service,即JMS)应用程序接口是一个Java平台中关于面向消息中间件(MOM)的api,用于在两个应用程序之间,或分布式系统中发送消息,进行异步通信。Java消息服务是一个与具体平台无关的api。
JMS的对象模型
| ConnectionFactory | 连接工厂 |
|---|---|
| Connection | 连接 |
| Session | 会话 |
| Destination | 目的 |
| MessageProducer | 生产者 |
| MessageConsumer | 消费者 |
| Message | 消息 |
| Broker | 消息中间件的实例(ActiveMQ) |
JMS的消息模型
Point-to-Point (P2P)/点对点
Publish/Subscribe(Pub/Sub)/主题(发布订阅)
JMS的消息结构
消息头
关于一些消息的描述信息
| JMSDestination | 消息的目的地,Topic或者是Queue |
|---|---|
| JMSDeliveryMode | 消息的发送模式 |
| JMSTimeStamp | 消息发送给Broker的时间戳,它不是实际发送时间 |
| JMSExpiration | 消息的有效期,在有效期内,消息消费者才可以消费这个消息 |
| JMSPriority | 消息的优先级。0-4为正常的优先级,5-9为高优先级 |
| JMSMessageID | 一个字符串用来唯一标示一个消息 |
| JMSReplyTo | 有时消息生产者希望消费者回复一个消息,JMSReplyTo为一个Destination,标示需要回复的目的地 |
| JMSCorrelationID | 通常用来关联多个Message |
| JMSType | 表示消息体的结构,和JMS提供者有关 |
| JMSDeliveryMode | 消息的发送模式 |
| JMSRedelivered | 如果这个值为true,表示消息是被重新发送了 |
*JMSDeliveryMode :比如说消息发送出去后,是否需要回执
消息属性
消息属性可以理解为消息的附加消息头,属性名可以自定义
消息体
消息体类型
| BytesMessage | 用来传递字节信息 |
|---|---|
| MapMessage | 用来传递键值对信息 |
| ObjectMessage | 用来传递序列化对象 |
| StreanmMessage | 用来传递文件等 |
| TextMessage | 用来传递字符串 |
ActiveMQ的特性
支持多种编程语言
支持多种传输协议
有多种持久化方式
ActiveMQ如何安装
环境准备
Centos7、jdk1.8
下载ActiveMQ
ActiveMQ服务
如何创建ActveMQ
ActiveMQ如何使用
使用ActiveMQ的Web管理平台
ActiveMQ自带有管理平台,在浏览器访问http://服务IP:8161/admin即可进入
ActiveMQ的管理页面默认开启了身份校验
帐号:admin
密码:admin
Web管理配置
引入ActiveMQ
使用Jar包
Maven依赖
在Spring中使用ActiveMQ
Spring官方教程
http://spring.io/guides/gs/messaging-jms/
Maven依赖
ActiveMQ入门安装
入门安装
在Java代码中使用ActiveMQ
在Java代码中使用ActiveMQ
今天的文章activemq amqp_ActiveMQ[通俗易懂]分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/77818.html
![activemq amqp_ActiveMQ[通俗易懂]插图1 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/f1720a8f09b94657b272bf629b9db9a3.png)
![activemq amqp_ActiveMQ[通俗易懂]插图3 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/fd80507f40af4d209e058a5ab4fac240.png)
![activemq amqp_ActiveMQ[通俗易懂]插图5 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/417e2702d619411d825dfa38ad499a95.png)
![activemq amqp_ActiveMQ[通俗易懂]插图7 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/5468a721ab734cf8b285b9d0da676c29.png)
![activemq amqp_ActiveMQ[通俗易懂]插图9 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/faf89f3f90e54a4e8a192e1ae5615568.png)
![activemq amqp_ActiveMQ[通俗易懂]插图11 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/00242677f76c4d6697b3a36fcf1e9487.png)
![activemq amqp_ActiveMQ[通俗易懂]插图13 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/d8730841711545ea92b2d8bf2f457c08.png)
![activemq amqp_ActiveMQ[通俗易懂]插图15 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/968834406a0f42d382a94381f06260fb.png)
![activemq amqp_ActiveMQ[通俗易懂]插图17 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/7e8de589f8104d9e9a2c3035671e1b8d.png)
![activemq amqp_ActiveMQ[通俗易懂]插图19 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/daa6c74365ed4dbaa9e9a561067c9be8.png)
![activemq amqp_ActiveMQ[通俗易懂]插图21 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/1b70f4b8de0e4f849998969999f0e2bd.png)
![activemq amqp_ActiveMQ[通俗易懂]插图23 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/7ea8b6810b6046b389f49a4e9d9a2a78.png)
![activemq amqp_ActiveMQ[通俗易懂]插图25 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/15d0c7f9a20c4f0cbd5fb804b7b0ee9d.png)
![activemq amqp_ActiveMQ[通俗易懂]插图27 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/44910685b2c64262b11db1f16d93542f.png)
![activemq amqp_ActiveMQ[通俗易懂]插图29 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/a647a2c975de49168e25ec6fe2f01f80.png)
![activemq amqp_ActiveMQ[通俗易懂]插图31 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/022d01e9e1d24160b54abf68081a24ca.png)
![activemq amqp_ActiveMQ[通俗易懂]插图33 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/38828ee23ad34f06ba87a0f1c8203286.png)
![activemq amqp_ActiveMQ[通俗易懂]插图35 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/e3233c697a2c4767bf78af1f80f33a0f.png)
![activemq amqp_ActiveMQ[通俗易懂]插图37 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/7527b22425ec4e7fa7cdef2e3187e001.png)
![activemq amqp_ActiveMQ[通俗易懂]插图39 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/dda51f44b658499b91a36ee76c4a0992.png)
![activemq amqp_ActiveMQ[通俗易懂]插图41 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/49a240a732964b778939b693ee9c5e19.png)