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.event.SerializableNotifierEvent; import com.qianwen.smartman.modules.notify.entity.NotifyHistoryEntity; import com.qianwen.smartman.modules.notify.service.INotifyHistoryService; @RocketMQMessageListener(consumerGroup = "notify-center-history-consumerblade-api", topic = "notify-center-history-topic", selectorExpression = "success||error") /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/message/rocket/consumer/NotifyHistoryConsumer.class */ public class NotifyHistoryConsumer implements RocketMQListener, RocketMQPushConsumerLifecycleListener { private final INotifyHistoryService notifyHistoryService; public NotifyHistoryConsumer(final INotifyHistoryService notifyHistoryService) { this.notifyHistoryService = notifyHistoryService; } public void prepareStart(DefaultMQPushConsumer consumer) { consumer.setMaxReconsumeTimes(3); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET); } public void onMessage(SerializableNotifierEvent serializableNotifierEvent) { this.notifyHistoryService.save(NotifyHistoryEntity.of(serializableNotifierEvent)); } }