package cn.axzo.workflow.server.mq.inside;

import cn.axzo.framework.rocketmq.BaseListener;
import cn.axzo.framework.rocketmq.EventConsumer;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.core.RocketMQListener;

import javax.annotation.Resource;

/**
 * 监听引擎自己的广播事件
 *
 * @author wangli
 * @since 2024-11-06 15:05
 */
//@Configuration(proxyBeanMethods = false)
public class SelfBoradcastRocketConfiguration {
    public static final String DEFAULT_EVENT = "topic_workflow_engine_";

//    @Component
//    @ConditionalOnProperty(name = "rocketmq.name-server")
//    @RocketMQMessageListener(topic = DEFAULT_EVENT + "${spring.profiles.active}",
//        consumerGroup = "GID_${spring.application.name}_workflow_engine_${spring.profiles.active}_consumer",
//        consumeMode = ConsumeMode.ORDERLY,
//        maxReconsumeTimes = 3,
//        nameServer = "${rocketmq.name-server}"
//    )
    public static class WorkflowEngineBroadcastConsumer extends BaseListener implements RocketMQListener<MessageExt> {
        @Resource
        private EventConsumer eventConsumer;

        @Override
        public void onMessage(MessageExt message) {
            super.onEvent(message, eventConsumer);
        }

    }
}
