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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: mq 会话并行消费监听
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/7/28
 */
@Service
public class SessionConcurrentlyImpl implements Concurrently {

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