[monitor]优化去除Kafka etcd依赖
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.usthe.alert;
|
||||
|
||||
import com.usthe.alert.pojo.entity.Alert;
|
||||
import com.usthe.common.entity.message.CollectRep;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -17,22 +16,12 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
public class AlerterDataQueue {
|
||||
|
||||
private final LinkedBlockingQueue<CollectRep.MetricsData> metricsDataQueue;
|
||||
private final LinkedBlockingQueue<Alert> alertDataQueue;
|
||||
|
||||
public AlerterDataQueue() {
|
||||
metricsDataQueue = new LinkedBlockingQueue<>();
|
||||
alertDataQueue = new LinkedBlockingQueue<>();
|
||||
}
|
||||
|
||||
public void addMetricsData(CollectRep.MetricsData metricsData) {
|
||||
metricsDataQueue.offer(metricsData);
|
||||
}
|
||||
|
||||
public CollectRep.MetricsData pollMetricsData() throws InterruptedException {
|
||||
return metricsDataQueue.poll(2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void addAlertData(Alert alert) {
|
||||
alertDataQueue.offer(alert);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user