package com.njcn.mq.template;

import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
import com.njcn.mq.constant.BusinessResource;
import com.njcn.mq.constant.BusinessTopic;
import com.njcn.mq.message.LogMessage;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;

/**
 * 类的介绍：记录日志
 *
 * @author xuyang
 * @version 1.0.0
 */
@Component
public class LogMessageTemplate extends RocketMQEnhanceTemplate {

    public LogMessageTemplate(RocketMQTemplate template) {
        super(template);
    }

    public SendResult sendMember(LogMessage logMessage) {
        logMessage.setSource(BusinessResource.APP_RESOURCE);
        return send(BusinessTopic.ZL_LOG_TOPIC, BusinessTopic.LogTag.LOG_TAG, logMessage);
    }
}
