yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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.notify.executor.NotifyExecutionContext;
import com.qianwen.core.notify.executor.NotifyQueueExecutorProvider;
 
@RocketMQMessageListener(consumerGroup = "notify-center-send-consumerblade-api", topic = "notify-center-send-topic")
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/message/rocket/consumer/NotifyQueueExecuteConsumer.class */
public class NotifyQueueExecuteConsumer implements RocketMQListener<NotifyExecutionContext>, RocketMQPushConsumerLifecycleListener {
    private final NotifyQueueExecutorProvider notifyQueueExecutorProvider;
 
    public NotifyQueueExecuteConsumer(final NotifyQueueExecutorProvider notifyQueueExecutorProvider) {
        this.notifyQueueExecutorProvider = notifyQueueExecutorProvider;
    }
 
    public void onMessage(NotifyExecutionContext taskExecutionContext) {
        this.notifyQueueExecutorProvider.executeNotify(taskExecutionContext);
    }
 
    public void prepareStart(DefaultMQPushConsumer consumer) {
        consumer.setMaxReconsumeTimes(3);
        consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
    }
}