Browse Source

消息队列封装,集成db
2019年5月21日10:24:30

herryhaixiao 5 years ago
parent
commit
ac43f2b27a

+ 21 - 15
elab-mq/pom.xml

@@ -22,6 +22,11 @@
             <artifactId>elab-spring</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.elab.core</groupId>
+            <artifactId>elab-db</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>com.aliyun.openservices</groupId>
             <artifactId>ons-client</artifactId>
@@ -55,25 +60,26 @@
             </plugin>
 
             <!-- 打包javadoc插件 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
+            <!--<plugin>-->
+                <!--<groupId>org.apache.maven.plugins</groupId>-->
+                <!--<artifactId>maven-javadoc-plugin</artifactId>-->
                 <!--<version>2.9</version>-->
-                <executions>
-                    <execution>
-                        <id>attach-javadocs</id>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                        <configuration>
-                            <additionalOptions>-Xdoclint:none</additionalOptions>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
+                <!--<executions>-->
+                    <!--<execution>-->
+                        <!--<id>attach-javadocs</id>-->
+                        <!--<goals>-->
+                            <!--<goal>jar</goal>-->
+                        <!--</goals>-->
+                        <!--<configuration>-->
+                            <!--<additionalOptions>-Xdoclint:none</additionalOptions>-->
+                        <!--</configuration>-->
+                    <!--</execution>-->
+                <!--</executions>-->
+            <!--</plugin>-->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.1</version>
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>

+ 14 - 0
elab-mq/src/main/java/com/elab/mq/dao/IConsumerDao.java

@@ -0,0 +1,14 @@
+package com.elab.mq.dao;
+
+import com.elab.core.aop.annotations.XmlGroupName;
+import com.elab.core.dao.IBaseDaoSupport;
+import com.elab.mq.model.ConsumerEntity;
+
+/**
+ * @author liuhx
+ * @create 2019/05/17 18:36
+ * @email liuhx@elab-plus.com
+ **/
+@XmlGroupName("consumer")
+public interface IConsumerDao extends IBaseDaoSupport<ConsumerEntity> {
+}

+ 15 - 0
elab-mq/src/main/java/com/elab/mq/dao/IProducerDao.java

@@ -0,0 +1,15 @@
+package com.elab.mq.dao;
+
+import com.elab.core.aop.annotations.XmlGroupName;
+import com.elab.core.dao.IBaseDaoSupport;
+import com.elab.mq.model.ProducerEntity;
+
+/**
+ * @author liuhx
+ * @create 2019/05/16 19:42
+ * @email liuhx@elab-plus.com
+ **/
+@XmlGroupName("producer")
+public interface IProducerDao extends IBaseDaoSupport<ProducerEntity> {
+
+}

+ 65 - 0
elab-mq/src/main/java/com/elab/mq/listener/AbstractMessageListener.java

@@ -4,9 +4,17 @@ import com.aliyun.openservices.ons.api.Action;
 import com.aliyun.openservices.ons.api.ConsumeContext;
 import com.aliyun.openservices.ons.api.Message;
 import com.aliyun.openservices.ons.api.MessageListener;
+import com.elab.core.exception.BusinessException;
+import com.elab.core.utils.DateUtils;
+import com.elab.core.utils.ObjectUtils;
+import com.elab.mq.dao.IConsumerDao;
+import com.elab.mq.dao.IProducerDao;
+import com.elab.mq.model.ConsumerEntity;
 import com.elab.mq.model.MessageModel;
+import com.elab.mq.model.ProducerEntity;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * 抽象成客户端能够使用的方法
@@ -18,6 +26,13 @@ public abstract class AbstractMessageListener implements MessageListener {
 
     private Logger logger = LoggerFactory.getLogger(getClass());
 
+    @Autowired
+    private IProducerDao producerDao;
+
+    @Autowired
+    private IConsumerDao consumerDao;
+
+
     /**
      * 客户端关注的topic消息,实现了该方法,消息监听被触发时会与之匹配。
      *
@@ -34,6 +49,51 @@ public abstract class AbstractMessageListener implements MessageListener {
         return "*";
     }
 
+
+    private ConsumerEntity init(String producerId) throws Exception {
+        ConsumerEntity oldConsumerEntity = new ConsumerEntity();
+        ProducerEntity producerEntity = producerDao.selectById(producerId);
+        logger.info("获取生产者的信息:" + ObjectUtils.objectParseJsonStr(producerEntity));
+        if (producerEntity != null) {
+            logger.info("进入消费者验证...");
+            ConsumerEntity consumerEntity = new ConsumerEntity();
+            consumerEntity.setProducerId(producerEntity.getId());
+            consumerEntity.setTopicId(producerEntity.getTopicId());
+            consumerEntity.setStatus(1);
+            oldConsumerEntity = consumerDao.selectByObject(consumerEntity);
+            if (oldConsumerEntity != null && oldConsumerEntity.getConsumerStatus().equals(1)) {
+                logger.info("消费者验证失败,已经消费成功过一次,不允许重复消费");
+                throw new BusinessException("请不要重复消费,key:" + producerId);
+            }
+            logger.info("消费者验证通过,消费者消费的数据匹配上生产者数据,");
+            if (oldConsumerEntity != null) {
+                oldConsumerEntity.setRetryCount(oldConsumerEntity.getRetryCount() + 1);
+                oldConsumerEntity.setConsumerStatus(-1);
+                oldConsumerEntity.setUpdated(DateUtils.getCurrentDateTime());
+                consumerDao.updateById(oldConsumerEntity);
+            } else {
+                oldConsumerEntity = new ConsumerEntity();
+                oldConsumerEntity.setProducerId(producerEntity.getId());
+                oldConsumerEntity.setContent(producerEntity.getContent());
+                oldConsumerEntity.setHouseId(producerEntity.getHouseId());
+                oldConsumerEntity.setModuleName(producerEntity.getModuleName());
+                oldConsumerEntity.setStatus(1);
+                oldConsumerEntity.setCreated(DateUtils.getCurrentDateTime());
+                oldConsumerEntity.setRetryCount(0);
+                oldConsumerEntity.setTopicId(producerEntity.getTopicId());
+                oldConsumerEntity.setConsumerStatus(0);
+                int id = consumerDao.insert(oldConsumerEntity);
+                oldConsumerEntity.setId(id);
+            }
+        } else {
+            logger.warn("生产者为空,无法匹配消费者");
+        }
+        return oldConsumerEntity;
+//        ConsumerEntity consumerEntity = new ConsumerEntity();
+
+    }
+
+
     /**
      * 客户端的业务逻辑实现
      *
@@ -49,7 +109,12 @@ public abstract class AbstractMessageListener implements MessageListener {
         logger.debug("消息处理被触发 : " + message.toString());
         Action action = null;
         try {
+            ConsumerEntity oldConsumerEntity = init(message.getKey());
+            logger.info("更新消费者数据: " + ObjectUtils.objectParseJsonStr(oldConsumerEntity));
             action = consume0(messageModel, consumeContext);
+
+            oldConsumerEntity.setConsumerStatus(1);
+            consumerDao.updateById(oldConsumerEntity);
         } catch (Exception e) {
             logger.debug("消息处理异常 : " + action);
             e.printStackTrace();

+ 195 - 0
elab-mq/src/main/java/com/elab/mq/model/ConsumerEntity.java

@@ -0,0 +1,195 @@
+package com.elab.mq.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+/**
+ * @author liuhx
+ * @create 2019/05/16 19:32
+ * @email liuhx@elab-plus.com
+ **/
+@Table(name = "mq_consumer", catalog = "elab_db")
+@ApiModel(description = "消息队列生产者 实体")
+public class ConsumerEntity {
+
+    @Id
+    @ApiModelProperty(name = "id", value = "主键")
+    private Integer id;
+
+    @Column(name = "producer_id")
+    @ApiModelProperty(name = "producer_id", value = "生产者id")
+    private Integer producerId;
+
+    @Column(name = "module_name")
+    @ApiModelProperty(name = "moduleName", value = "微服务模块名")
+    private String moduleName;
+
+    @Column(name = "house_id")
+    @ApiModelProperty(name = "houseId", value = "项目id")
+    private Integer houseId;
+
+    @Column(name = "topic_id")
+    @ApiModelProperty(name = "topicId", value = "队列通道id")
+    private String topicId;
+
+    @Column(name = "content")
+    @ApiModelProperty(name = "content", value = "内容")
+    private String content;
+
+    @Column(name = "consumer_status")
+    @ApiModelProperty(name = "consumerStatus", value = "消费者状态 1成功-1失败")
+    private Integer consumerStatus;
+
+    @Column(name = "retry_count")
+    @ApiModelProperty(name = "retryCount", value = "失败重试次数")
+    private Integer retryCount;
+
+    /**
+     * 状态:1  有效  -1  无效
+     *
+     */
+    @Column(name = "status")
+    @ApiModelProperty(name = "status", value = "状态:1  有效  -1  无效")
+    private Integer status;
+
+    /**
+     * 创建时间
+     *
+     */
+    @Column(name = "created")
+    @ApiModelProperty(name = "created", value = "创建时间")
+    private Date created;
+
+    /**
+     * 修改时间
+     *
+     */
+    @Column(name = "updated")
+    @ApiModelProperty(name = "updated", value = "修改时间")
+    private Date updated;
+
+    /**
+     * 创建者
+     *
+     */
+    @Column(name = "creator")
+    @ApiModelProperty(name = "creator", value = "创建者")
+    private String creator;
+
+    /**
+     * 修改者
+     *
+     */
+    @Column(name = "updator")
+    @ApiModelProperty(name = "updator", value = "修改者")
+    private String updator;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getProducerId() {
+        return producerId;
+    }
+
+    public void setProducerId(Integer producerId) {
+        this.producerId = producerId;
+    }
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    public Integer getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(Integer houseId) {
+        this.houseId = houseId;
+    }
+
+    public String getTopicId() {
+        return topicId;
+    }
+
+    public void setTopicId(String topicId) {
+        this.topicId = topicId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Integer getConsumerStatus() {
+        return consumerStatus;
+    }
+
+    public void setConsumerStatus(Integer consumerStatus) {
+        this.consumerStatus = consumerStatus;
+    }
+
+    public Integer getRetryCount() {
+        return retryCount;
+    }
+
+    public void setRetryCount(Integer retryCount) {
+        this.retryCount = retryCount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    public Date getUpdated() {
+        return updated;
+    }
+
+    public void setUpdated(Date updated) {
+        this.updated = updated;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getUpdator() {
+        return updator;
+    }
+
+    public void setUpdator(String updator) {
+        this.updator = updator;
+    }
+}

+ 28 - 0
elab-mq/src/main/java/com/elab/mq/model/MessageModel.java

@@ -14,6 +14,10 @@ import com.elab.core.utils.StringUtils;
 public class MessageModel<T> extends Message {
 
     private T object;
+    private String groupId;
+    private Integer houseId;
+    private String moduleName;
+
 
     /**
      * 使用该model传递参数
@@ -88,4 +92,28 @@ public class MessageModel<T> extends Message {
         String s = JSON.toJSONString(object);
         setBody(s.getBytes());
     }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public Integer getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(Integer houseId) {
+        this.houseId = houseId;
+    }
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
 }

+ 184 - 0
elab-mq/src/main/java/com/elab/mq/model/ProducerEntity.java

@@ -0,0 +1,184 @@
+package com.elab.mq.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+/**
+ * @author liuhx
+ * @create 2019/05/16 19:32
+ * @email liuhx@elab-plus.com
+ **/
+@Table(name = "mq_producer", catalog = "elab_db")
+@ApiModel(description = "消息队列生产者 实体")
+public class ProducerEntity {
+
+    @Id
+    @ApiModelProperty(name = "id", value = "主键")
+    private Integer id;
+
+    @Column(name = "module_name")
+    @ApiModelProperty(name = "moduleName", value = "微服务模块名")
+    private String moduleName;
+
+    @Column(name = "house_id")
+    @ApiModelProperty(name = "houseId", value = "项目id")
+    private Integer houseId;
+
+    @Column(name = "producer_status")
+    @ApiModelProperty(name = "producerStatus", value = "生产者状态 1成功-1失败")
+    private Integer producerStatus;
+
+    @Column(name = "group_id")
+    @ApiModelProperty(name = "groupId", value = "队列的groupId")
+    private String groupId;
+
+    @Column(name = "topic_id")
+    @ApiModelProperty(name = "topicId", value = "队列通道id")
+    private String topicId;
+
+    @Column(name = "content")
+    @ApiModelProperty(name = "content", value = "内容")
+    private String content;
+
+
+    /**
+     * 状态:1  有效  -1  无效
+     *
+     */
+    @Column(name = "status")
+    @ApiModelProperty(name = "status", value = "状态:1  有效  -1  无效")
+    private Integer status;
+
+    /**
+     * 创建时间
+     *
+     */
+    @Column(name = "created")
+    @ApiModelProperty(name = "created", value = "创建时间")
+    private Date created;
+
+    /**
+     * 修改时间
+     *
+     */
+    @Column(name = "updated")
+    @ApiModelProperty(name = "updated", value = "修改时间")
+    private Date updated;
+
+    /**
+     * 创建者
+     *
+     */
+    @Column(name = "creator")
+    @ApiModelProperty(name = "creator", value = "创建者")
+    private String creator;
+
+    /**
+     * 修改者
+     *
+     */
+    @Column(name = "updator")
+    @ApiModelProperty(name = "updator", value = "修改者")
+    private String updator;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getModuleName() {
+        return moduleName;
+    }
+
+    public void setModuleName(String moduleName) {
+        this.moduleName = moduleName;
+    }
+
+    public Integer getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(Integer houseId) {
+        this.houseId = houseId;
+    }
+
+    public Integer getProducerStatus() {
+        return producerStatus;
+    }
+
+    public void setProducerStatus(Integer producerStatus) {
+        this.producerStatus = producerStatus;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getTopicId() {
+        return topicId;
+    }
+
+    public void setTopicId(String topicId) {
+        this.topicId = topicId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    public Date getUpdated() {
+        return updated;
+    }
+
+    public void setUpdated(Date updated) {
+        this.updated = updated;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getUpdator() {
+        return updator;
+    }
+
+    public void setUpdator(String updator) {
+        this.updator = updator;
+    }
+}

+ 60 - 0
elab-mq/src/main/java/com/elab/mq/msg/impl/MsgProducerImpl.java

@@ -2,12 +2,17 @@ package com.elab.mq.msg.impl;
 
 import com.aliyun.openservices.ons.api.SendResult;
 import com.aliyun.openservices.ons.api.bean.ProducerBean;
+import com.elab.core.utils.DateUtils;
+import com.elab.core.utils.ObjectUtils;
+import com.elab.mq.dao.IProducerDao;
 import com.elab.mq.model.MessageModel;
+import com.elab.mq.model.ProducerEntity;
 import com.elab.mq.model.SendResultModel;
 import com.elab.mq.msg.IMsgProducerFacade;
 import com.elab.mq.msg.adptor.SendCallbackAdaptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.Date;
 import java.util.Properties;
@@ -21,18 +26,73 @@ import java.util.Properties;
  **/
 public class MsgProducerImpl extends ProducerBean implements IMsgProducerFacade {
 
+
     private Logger logger = LoggerFactory.getLogger(MsgProducerImpl.class);
 
+    @Autowired
+    private IProducerDao producerDao;
+
+
+    /**
+     * 往生产者表中写入数据
+     * @param message
+     * @return
+     */
+    private int insertRecordProducer(MessageModel message) {
+        String content = ObjectUtils.objectParseJsonStr(message.getObject(Object.class));
+        ProducerEntity producerEntity = new ProducerEntity();
+        producerEntity.setModuleName(message.getModuleName());
+        producerEntity.setHouseId(message.getHouseId());
+        producerEntity.setProducerStatus(0);
+        producerEntity.setGroupId(message.getGroupId());
+        producerEntity.setTopicId(message.getTopic());
+        producerEntity.setContent(content);
+        producerEntity.setStatus(1);
+        producerEntity.setCreated(DateUtils.getCurrentDateTime());
+        int id = 0;
+        try {
+            id = producerDao.insert(producerEntity);
+            message.setKey(id + "");
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error("往生产者表中插入记录失败:,入参:" + ObjectUtils.objectParseJsonStr(message), e);
+        }
+        return id;
+    }
+
+    /**
+     * 修改生产者数据
+     * @param id
+     * @return
+     */
+    private void updateRecordProducer(int id) {
+
+        try {
+            ProducerEntity producerEntity = producerDao.selectById(id + "");
+            if (producerEntity != null) {
+                producerEntity.setProducerStatus(1);
+                producerDao.updateById(producerEntity);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            logger.error("修改生产者表中记录失败:,入参:" + id, e);
+        }
+    }
+
     @Override
     public void sendAsync(MessageModel message, SendCallbackAdaptor sendCallback) {
         logger.debug(" 发送一条异步消息 " + message + " -> " + message.toString() + " 回调类 : " + sendCallback.getClass().getName());
         super.sendAsync(message, sendCallback);
+
+
     }
 
     @Override
     public SendResultModel send(MessageModel message) {
         logger.debug(" 发送一条消息 " + message.getMsgID() + " -> " + message.toString());
+        int id = insertRecordProducer(message);
         SendResult result = super.send(message);
+        updateRecordProducer(id);
         logger.debug(" 消息发送结果 : " + result.toString());
         return new SendResultModel(result);
     }

+ 0 - 84
elab-mq/src/test/java/com/elab/mq/config/RocketMQConfigurationTest.java

@@ -1,84 +0,0 @@
-package com.elab.mq.config;
-
-
-import com.alibaba.fastjson.JSONObject;
-import com.aliyun.openservices.ons.api.*;
-import com.elab.core.utils.RandomUtils;
-import com.elab.mq.model.MessageModel;
-import com.elab.mq.msg.IMsgProducerFacade;
-import com.elab.mq.msg.impl.MsgProducerImpl;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-
-//@RunWith(SpringJUnit4ClassRunner.class)
-//@ContextConfiguration(classes = RocketMQConfiguration.class)
-//@WebAppConfiguration("classpath:application.properties")
-//@TestPropertySource("classpath:application.properties")
-public class RocketMQConfigurationTest {
-    String topic = "T_consumer2";
-
-    @Test
-    public void mqProperties() {
-        IMsgProducerFacade producerBean = new MsgProducerImpl();
-        producerBean.setProperties(getProperties());
-        producerBean.start();
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("xxx", "哈哈");
-        jsonObject.put("sss", "ggg");
-        for (int i = 0; i < 10; i++) {
-            String key = RandomUtils.randomString(10);
-            MessageModel message = new MessageModel<Map>("T-consumer1", "*", key, jsonObject);
-            SendResult send = producerBean.send(message);
-            System.out.println("发送消息返回结果 : " + send.toString());
-        }
-    }
-
-    /**
-     * 对于全局顺序消息,建议创建实例个数 >=2。 同时运行多个实例的作用是为了防止工作实例意外退出时,业务中断。 当工作实例退出时,其他实例可以立即接手工作,不会导致业务中断,实际同时工作的只会有一个实例。
-     *
-     * @throws IOException
-     */
-    @Test
-    public void consumer() throws IOException {
-        Properties properties = getProperties();
-        properties.put(PropertyKeyConst.GROUP_ID, "GID-producer1");
-        Consumer consumer = ONSFactory.createConsumer(properties);
-        MessageListener messageListener = new MessageListener() {
-            @Override
-            public Action consume(Message message, ConsumeContext consumeContext) {
-                System.out.println("消费到的消息 : " + message.toString());
-                return Action.CommitMessage;
-            }
-        };
-
-        consumer.subscribe(topic, "*", messageListener);
-        consumer.subscribe("T-consumer1", "*", messageListener);
-
-        consumer.start();
-        System.out.println("Consumer Started");
-        System.in.read();
-    }
-
-    public Properties getProperties() {
-        Properties properties = new Properties();
-        // AccessKey 阿里云身份验证,在阿里云服务器管理控制台创建
-        properties.put(PropertyKeyConst.AccessKey, "LTAImNZed054h0YV");
-        // SecretKey 阿里云身份验证,在阿里云服务器管理控制台创建
-        properties.put(PropertyKeyConst.SecretKey, "8hmhlhiQ2ikmVeLKujwMNWsktFpSzm");
-        // 设置 TCP 接入域名,进入控制台的实例管理页面的“获取接入点信息”区域查看
-        properties.put(PropertyKeyConst.NAMESRV_ADDR, "http://MQ_INST_1819241776271348_Bak3xjk0.mq-internet-access.mq-internet.aliyuncs.com:80");
-        properties.put(PropertyKeyConst.GROUP_ID, "GID-producer1");
-        //设置发送超时时间,单位毫秒
-        properties.setProperty(PropertyKeyConst.SendMsgTimeoutMillis, "5000");
-
-        properties.put(PropertyKeyConst.OnsChannel, "ALIYUN");
-        // 顺序消息消费者失败进行重试前的等待时间(单位毫秒)
-        properties.put(PropertyKeyConst.SuspendTimeMillis, "100");
-        // 消费失败的重试次数
-        properties.put(PropertyKeyConst.MaxReconsumeTimes, "20");
-        return properties;
-    }
-}

+ 0 - 20
elab-mq/src/test/resources/applicationContext.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
-    http://www.springframework.org/schema/context
-    http://www.springframework.org/schema/context/spring-context.xsd
-    ">
-    <!--<context:property-placeholder location="classpath:application.properties" />-->
-
-    <context:component-scan base-package="com.elab.mq">
-        <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
-        <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
-        <context:include-filter type="annotation" expression="org.springframework.stereotype.Component"/>
-        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
-    </context:component-scan>
-
-
-</beans>