
package com.mortals.xhx.queue.provider;

import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TbQueueProducer;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * 初始化消息生产者服务
 */
@CommonsLog
@Service
public class TbCoreQueueProducerProvider implements TbQueueProducerProvider {

    /**
     * 消息队列提供
     */
    @Autowired
    private TbCoreQueueFactory tbQueueProvider;

    /**
     * 消息队列生产者
     */
    private TbQueueProducer<TbQueueMsg> queueProducer;

    @PostConstruct
    public void init() {
        log.info("消息队列生产服务开始...");
        this.queueProducer = tbQueueProvider.createMsgProducer();
    }

    @Override
    public TbQueueProducer<TbQueueMsg> getTbCoreMsgProducer() {
        return queueProducer;
    }


}
