package cn.axzo.workflow.server.mq.outside.producer;

import cn.axzo.framework.rocketmq.Event;
import cn.axzo.framework.rocketmq.RocketMQEventProducer;
//import cn.axzo.riven.client.common.enums.DingtalkEventEnum;
//import cn.axzo.riven.client.model.DingtalkSendMqModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.function.BiConsumer;

/**
 * 回复钉钉消息给 Riven 的事件生产者
 *
 * @author wangli
 * @since 2024-10-25 11:33
 */
@Slf4j
@Component
public class DingtalkSendProducer extends RocketMQEventProducer {
    @Value("${spring.application.name}")
    private String applicationName;
    public DingtalkSendProducer(RocketMQTemplate rocketMQTemplate, String defaultModule, String appName, Context<RocketMQMessageMeta> defaultContext, BiConsumer<Event, Context<RocketMQMessageMeta>> sendCallback) {
        super(rocketMQTemplate, defaultModule, appName, defaultContext, sendCallback);
    }

//    public void send(DingtalkSendMqModel model) {
//        send(Event.builder()
//                .shardingKey(applicationName)
//                .eventCode(DingtalkEventEnum.send.getEventCode())
//                .targetId(model.getTraceId())
//                .targetType(DingtalkEventEnum.send.getTag())
//                .data(model)
//                .build());
//    }

}
