jms

springmvc和activemq的整合使用

风流意气都作罢 提交于 2020-03-27 04:53:02
1、简介:ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线。ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久的事情了,但是JMS在当今的J2EE应用中间仍然扮演着特殊的地位。 2、建议在使用以前了解一下jms的一些知识 3、第一步:我们部署相关的activemq(我这里是采用自己本地linux虚拟机来实现的,以模拟中间推送消息的原理)   activemq下载地址: http://archive.apache.org/dist/activemq/ 我用的是目前最新的5.14.5版本 这里有这个zip的是windows用的,tar.gz的是Linux用的。我这里采用的Linux部署 将activemq的tar解压启动 启动方式在: /root/apache-activemq-5.14.5/bin/linux-x86-64 启动:./activemq start 暂停: ./activemq stop 重启:./activemq restart 启动起来后,访问地址为:http://192.168.5.10:8161/admin 账号密码:都是admin(默认) 开机自启:vi /etc/rc.local 然后在末尾加入 su - root -c '/usr/local

ActiveMQ (一):安装启动及测试

让人想犯罪 __ 提交于 2020-03-27 01:26:16
1. 预备知识   1.1 JMS     JMS(Java Messaging Service)是Java平台上有关面向消息中间件(MOM)的技术规范。< 百科 >   1.2 JMX     JMX(Java Management Extensions,即Java管理扩展)是一个为应用程序、设备、系统等植入管理功能的框架。< 百科 >   1.3 订阅者模式     一种设计模式,存在生产者和消费者两种角色,多个消费者订阅生产者的内容,生产者产生内容后分发到各个消费者中。 2. ActiveMQ    2.1 简介     ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线。ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久的事情了,但是JMS在当今的J2EE应用中间仍然扮演着特殊的地位。      2.2 安装启动及测试使用     安装方式有多种,这里选择 Binary Installation.     2.1.1 Windows       a. 下载zip压缩包         下载地址: http://archive.apache.org/dist/activemq/         在此地址下,选择自己要使用的版本,进入到指定的文件夹下,选择zip压缩包,下载;   

How to stop getting messages deleted without acknowledgement in Oracle AQ?

泪湿孤枕 提交于 2020-03-25 12:32:16
问题 I have set up a single customer Oracle AQ. I observe messages from this queue in a Java web application with CLIENT_ACKNOWLEDGE mode. But as soon as I receive the messages in the onMessage method, the messages seems to be getting deleted from the Oracle Queue. My assumption is, the message should not get deleted unless I acknowledge them in the client. How do I stop this? Oracle Queue schema looks like this: BEGIN DBMS_AQADM.CREATE_QUEUE_TABLE( Queue_table => '"TESTUSER"."myqueuetable"',

[JMS 3] ActiveMQ实现简单的helloworld

≯℡__Kan透↙ 提交于 2020-03-24 01:04:34
3 月,跳不动了?>>> 目录 (?) [-] 开发环境 搭建开发环境 运行 总结 第一篇博文 深入浅出JMS(一)–JMS基本概念 ,我们介绍了JMS的两种消息模型:点对点和发布订阅模型,以及消息被消费的两个方式:同步和异步,JMS编程模型的对象,最后说了JMS的优点。 第二篇博文 深入浅出JMS(二)–ActiveMQ简单介绍以及安装 ,我们介绍了消息中间件ActiveMQ,安装,启动,以及优缺点。 这篇博文,我们使用ActiveMQ为大家实现一种点对点的消息模型。如果你对点对点模型的认识较浅,可以看一下第一篇博文的介绍。 JMS其实并没有想象的那么高大上,看完这篇博文之后,你就知道什么叫简单,下面直接进入主题。 开发环境 我们使用的是ActiveMQ 5.11.1 Release的Windows版,官网最新版是ActiveMQ 5.12.0 Release,大家可以自行下载, 下载地址 。 需要注意的是,开发时候,要将apache-activemq-5.11.1-bin.zip解压缩后里面的activemq-all-5.11.1.jar包加入到classpath下面,这个包包含了所有jms接口api的实现。 搭建开发环境 建立项目 我们只需要建立一个java项目就可以了,导入jar包,项目截图: 点对点的消息模型,只需要一个消息生成者和消息消费者,下面我们编写代码。

ActiveMQ学习笔记(5)——使用Spring JMS收发消息

假装没事ソ 提交于 2020-03-23 11:22:12
3 月,跳不动了?>>> ActiveMQ学习笔记(四) http://my.oschina.net/xiaoxishan/blog/380446 中记录了如何使用原生的方式从ActiveMQ中收发消息。可以看出,每次收发消息都要写许多重复的代码,Spring 为我们提供了更为方便的方式,这就是Spring JMS。我们通过一个例子展开讲述。包括队列、主题消息的收发相关的Spring配置、代码、测试。 本例中,消息的收发都写在了一个工程里。 1.使用maven管理依赖包 <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-all</artifactId> <version>5.11.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId>

How to connect to JMS queue JBoss EAP 7 behind NAT?

不打扰是莪最后的温柔 提交于 2020-03-23 01:19:38
问题 I have configured JBoss EAP 7.0 which is behind NAT gateway. JMS client can successfully connect to JMS queues from same server or another saver from same network. But when same JMS client is moved out of that network and try to connect to JMS through NAT gateway it cant connect to the queue. Same behavior is encountered in both development environment and aws ec2 in vpc. Development environment has a NAT gateway and I presume vpc also uses same or similar thing. I started with the code found

How to connect to JMS queue JBoss EAP 7 behind NAT?

点点圈 提交于 2020-03-23 01:18:40
问题 I have configured JBoss EAP 7.0 which is behind NAT gateway. JMS client can successfully connect to JMS queues from same server or another saver from same network. But when same JMS client is moved out of that network and try to connect to JMS through NAT gateway it cant connect to the queue. Same behavior is encountered in both development environment and aws ec2 in vpc. Development environment has a NAT gateway and I presume vpc also uses same or similar thing. I started with the code found

大型网站系统架构系列:分布式消息队列(二)

旧时模样 提交于 2020-03-22 03:43:14
四、JMS消息服务 讲消息队列就不得不提JMS 。JMS(JAVA Message Service,java消息服务)API是一个消息服务的标准/规范,允许应用程序组件基于JavaEE平台创建、发送、接收和读取消息。它使分布式通信耦合度更低,消息服务更加可靠以及异步性。 在EJB架构中,有消息bean可以无缝的与JM消息服务集成。在J2EE架构模式中,有消息服务者模式,用于实现消息与应用直接的解耦。 4.1消息模型 在JMS标准中,有两种消息模型P2P(Point to Point),Publish/Subscribe(Pub/Sub)。 4.1.1 P2P模式 P2P模式包含三个角色:消息队列(Queue),发送者(Sender),接收者(Receiver)。每个消息都被发送到一个特定的队列,接收者从队列中获取消息。队列保留着消息,直到他们被消费或超时。 P2P的特点 每个消息只有一个消费者(Consumer)(即一旦被消费,消息就不再在消息队列中) 发送者和接收者之间在时间上没有依赖性,也就是说当发送者发送了消息之后,不管接收者有没有正在运行,它不会影响到消息被发送到队列 接收者在成功接收消息之后需向队列应答成功 如果希望发送的每个消息都会被成功处理的话,那么需要P2P模式。(架构KKQ:466097527,欢迎加入) 4.1.2 Pub/sub模式 包含三个角色主题

What's the Purpose of setting the clientID for JMS publisher / consumer?

天涯浪子 提交于 2020-03-19 19:34:13
问题 I understand that i need to set the clientId and subscription name when writing the jms topic subscriber for my durable topics. But Whats the purpose of setting the clientID when publishing the TOPIC ? I have seen people setting the client Id even for publisher / consumer, but no one explained that why it is required. ConnectionFactory conFactory = this.getConnectionFactory(); Connection connection = conFactory.createConnection(); connection.setClientID("WHATS_MY_PURPOSE"); // Why do we need

Docker-compose部署jumpserver堡垒机

北城以北 提交于 2020-03-17 11:01:29
一.环境部署 1.搭建docker环境 yum -y install docker 2.安装docker-compose curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose chmod +x /usr/bin/docker-compose 3.创建项目目录 mkdir -p /data/jms cd /data/jms 4.下载jms的docker项目 git clone https://github.com/wojiushixiaobai/docker-compose.git [root@localhost docker-compose]# cat docker-compose.yml version: '3' services: mysql: image: wojiushixiaobai/jms_mysql:${Version} container_name: jms_mysql restart: always tty: true environment: DB_PORT: $DB_PORT DB_USER: $DB_USER DB_PASSWORD: $DB