feat(REQ-3114) - 配合 riven 进行 MQ 消息的监听处理

This commit is contained in:
wangli 2024-10-28 15:57:57 +08:00
parent 521805c2ef
commit e51a2836e8

View File

@ -11,9 +11,11 @@ import cn.axzo.workflow.server.outside.mq.producer.DingtalkSendProducer;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
/**
* 监听钉钉群消息的事件
@ -24,7 +26,8 @@ import javax.annotation.Resource;
@Slf4j
@Component
public class DingtalkReceiveListener implements EventHandler, InitializingBean {
@Value("${spring.application.name}")
private String applicationName;
@Resource
private EventConsumer eventConsumer;
@Resource
@ -34,6 +37,9 @@ public class DingtalkReceiveListener implements EventHandler, InitializingBean {
public void onEvent(Event event, EventConsumer.Context context) {
log.info("receive dingding message: {}", event.getTargetId());
if (!Objects.equals(applicationName, event.getTargetType())) {
return;
}
DingtalkReceiveMqModel data = event.normalizedData(DingtalkReceiveMqModel.class);
if (log.isDebugEnabled()) {
log.debug("message data: {}", JSON.toJSONString(data));