package com.qianwen.smartman.modules.notify.message.rocket.consumer;
|
|
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
import org.apache.rocketmq.spring.core.RocketMQPushConsumerLifecycleListener;
|
import com.qianwen.core.context.task.TaskExecutionContext;
|
import com.qianwen.core.notify.executor.NotifyTaskExecutorProvider;
|
|
@RocketMQMessageListener(consumerGroup = "task-center-notify-consumerblade-api", topic = "task-center-topic")
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/message/rocket/consumer/NotifyTaskExecuteConsumer.class */
|
public class NotifyTaskExecuteConsumer implements RocketMQListener<TaskExecutionContext>, RocketMQPushConsumerLifecycleListener {
|
private final NotifyTaskExecutorProvider notifyTaskExecutorProvider;
|
|
public NotifyTaskExecuteConsumer(final NotifyTaskExecutorProvider notifyTaskExecutorProvider) {
|
this.notifyTaskExecutorProvider = notifyTaskExecutorProvider;
|
}
|
|
public void onMessage(TaskExecutionContext taskExecutionContext) {
|
if (this.notifyTaskExecutorProvider.getExecutor().equals(taskExecutionContext.getExecutor())) {
|
this.notifyTaskExecutorProvider.executeTask(taskExecutionContext);
|
}
|
}
|
|
public void prepareStart(DefaultMQPushConsumer consumer) {
|
consumer.setMaxReconsumeTimes(3);
|
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
|
}
|
}
|