package com.qmth.themis.mq.templete.impl;

import com.qmth.themis.business.constant.SpringContextHolder;
import com.qmth.themis.business.enums.MqExecTypeEnum;
import com.qmth.themis.mq.service.MqLogicService;
import com.qmth.themis.mq.templete.Concurrently;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: mq 延时消息监听 websocket超时退出 并行消费监听
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/7/28
 */
@Service
public class WebsocketUnNormalConcurrentlyImpl implements Concurrently {

    @Override
    public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
        MqLogicService mqLogicService = SpringContextHolder.getBean(MqLogicService.class);
        return mqLogicService.consumeMessageDelay(msgs, consumeConcurrentlyContext, MqExecTypeEnum.EXEC_MQ_WEBSOCKET_UN_NORMAL_LOGIC);
    }
}
