前言
上篇讲了activeMQ之Queue(队列)基础知识点,在此基础上加入websocket,消息的持久化、消费者手动签收机制、消息重发机制。
springboot整合activeMQ系列之Queue(一)
在系列一的基础上对消费者工程改造
pom文件增加了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
消费者目录
配置文件
配置文件有websocket的配置和activeMQ队列的持久化、签收、重发机制的相关设计
package com.example.bootcustomer.config;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.RedeliveryPolicy;
import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import javax.jms.DeliveryMode;
import javax.jms.Queue;
import javax