package com.qmth.themis.business.util;

import com.qmth.themis.business.domain.MqConfigDomain;
import com.qmth.themis.business.domain.MqGroupDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: rocket mq util
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/11/13
 */
@Component
public class MqUtil {
    private final static Logger log = LoggerFactory.getLogger(MqUtil.class);

    private MqGroupDomain mqGroupDomain;

    @Bean
    public MqGroupDomain mqGroupDomainInit(MqConfigDomain mqConfigDomain) {
        Map<String, String> map = new HashMap<>();
        map.putAll(mqConfigDomain.getMap());
        mqGroupDomain = new MqGroupDomain(mqConfigDomain.getTopic(), map);
        return mqGroupDomain;
    }

    public MqGroupDomain getMqGroupDomain() {
        return mqGroupDomain;
    }
}
