yangys
2024-03-27 44028c2d1a7f21da831cb07ecb1b4a7873d8627b
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
29
30
31
32
33
34
35
package com.qianwen.core.notify.executor;
 
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.context.task.TaskExecutionContext;
import com.qianwen.core.context.task.TaskExecutorProvider;
import com.qianwen.core.notify.NotifyQueueProducer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Component;
 
@ConditionalOnBean({INotifyTaskService.class, NotifyQueueProducer.class})
@Component
/* loaded from: blade-starter-notify-9.3.0.0-SNAPSHOT.jar:org/springblade/core/notify/executor/NotifyTaskExecutorProvider.class */
public class NotifyTaskExecutorProvider implements TaskExecutorProvider {
    private static final Logger log = LoggerFactory.getLogger(NotifyTaskExecutorProvider.class);
    private final INotifyTaskService notifyTaskService;
    private final NotifyQueueProducer notifyQueueProducer;
 
    public NotifyTaskExecutorProvider(final INotifyTaskService notifyTaskService, final NotifyQueueProducer notifyQueueProducer) {
        this.notifyTaskService = notifyTaskService;
        this.notifyQueueProducer = notifyQueueProducer;
    }
 
    public String getExecutor() {
        return "notifier_task";
    }
 
    public void executeTask(TaskExecutionContext context) {
        List<NotifyExecutionContext> notifyExecutionContexts = this.notifyTaskService.createNotifyExecutionContext(context);
        notifyExecutionContexts.forEach(x -> {
            this.notifyQueueProducer.asyncSend(x);
        });
    }
}