package com.diagbot.rabbit;

import com.diagbot.entity.SysLog;
import com.diagbot.util.GsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.MessageChannel;
import org.springframework.stereotype.Component;

/**
 * @Description: 发布者
 * @author: gaodm
 * @time: 2018/8/29 13:41
 */
@Component
@EnableBinding({MyProcessor.class})
public class MySender {
    @Autowired
    @Qualifier("outputLog")
    MessageChannel outputLog;

    public void outputLogSend(SysLog sysLog){
        outputLog.send(MessageBuilder.withPayload(GsonUtil.toJson(sysLog)).build());
    }
}
