Search in sources :

Example 1 with AlertManager

use of com.thinkbiganalytics.alerts.spi.AlertManager in project kylo by Teradata.

the class AggregatingAlertProvider method findActionableAlert.

private SimpleEntry<Alert, AlertManager> findActionableAlert(ID id) {
    SourceAlertID srcId = asSourceAlertId(id);
    AlertManager mgr = this.managers.get(srcId.sourceId);
    if (mgr != null) {
        return getAlert(srcId.alertId, mgr, true).filter(alert -> alert.isActionable()).map(alert -> new SimpleEntry<>(unwrapAlert(alert), mgr)).orElse(null);
    } else {
        return null;
    }
}
Also used : ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) AlertManager(com.thinkbiganalytics.alerts.spi.AlertManager) AlertResponder(com.thinkbiganalytics.alerts.api.AlertResponder) Proxy(java.lang.reflect.Proxy) LoggerFactory(org.slf4j.LoggerFactory) AlertSource(com.thinkbiganalytics.alerts.spi.AlertSource) Registration(reactor.bus.registry.Registration) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) AlertSummary(com.thinkbiganalytics.alerts.api.AlertSummary) Inject(javax.inject.Inject) PreDestroy(javax.annotation.PreDestroy) AlertProvider(com.thinkbiganalytics.alerts.api.AlertProvider) Alert(com.thinkbiganalytics.alerts.api.Alert) Event(reactor.bus.Event) Map(java.util.Map) StreamSupport(java.util.stream.StreamSupport) Named(javax.inject.Named) Method(java.lang.reflect.Method) SimpleEntry(java.util.AbstractMap.SimpleEntry) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) AlertNotifyReceiver(com.thinkbiganalytics.alerts.spi.AlertNotifyReceiver) Executor(java.util.concurrent.Executor) DateTime(org.joda.time.DateTime) SourceAlert(com.thinkbiganalytics.alerts.api.SourceAlert) EventBus(reactor.bus.EventBus) Executors(java.util.concurrent.Executors) Serializable(java.io.Serializable) ID(com.thinkbiganalytics.alerts.api.Alert.ID) Objects(java.util.Objects) List(java.util.List) Stream(java.util.stream.Stream) MatchAllSelector(reactor.bus.selector.MatchAllSelector) AlertSourceAggregator(com.thinkbiganalytics.alerts.spi.AlertSourceAggregator) AlertListener(com.thinkbiganalytics.alerts.api.AlertListener) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) InvocationHandler(java.lang.reflect.InvocationHandler) Consumer(reactor.fn.Consumer) Collections(java.util.Collections) AlertCriteria(com.thinkbiganalytics.alerts.api.AlertCriteria) AlertResponse(com.thinkbiganalytics.alerts.api.AlertResponse) AlertManager(com.thinkbiganalytics.alerts.spi.AlertManager) SimpleEntry(java.util.AbstractMap.SimpleEntry)

Example 2 with AlertManager

use of com.thinkbiganalytics.alerts.spi.AlertManager in project kylo by Teradata.

the class AggregatingAlertProvider method accept.

/* (non-Javadoc)
     * @see reactor.fn.Consumer#accept(java.lang.Object)
     */
@Override
public void accept(Event<Alert> event) {
    final Alert alert = unwrapAlert(event.getData());
    final AlertManager mgr = (AlertManager) alert.getSource();
    final List<AlertResponder> responders = snapshotResponderts();
    responders.forEach(responder -> {
        AlertResponse resp = mgr.getResponse(alert);
        AlertResponseWrapper wrapper = new AlertResponseWrapper(resp);
        responder.alertChange(alert, wrapper);
    });
}
Also used : AlertManager(com.thinkbiganalytics.alerts.spi.AlertManager) AlertResponse(com.thinkbiganalytics.alerts.api.AlertResponse) Alert(com.thinkbiganalytics.alerts.api.Alert) SourceAlert(com.thinkbiganalytics.alerts.api.SourceAlert) AlertResponder(com.thinkbiganalytics.alerts.api.AlertResponder)

Aggregations

Alert (com.thinkbiganalytics.alerts.api.Alert)2 AlertResponder (com.thinkbiganalytics.alerts.api.AlertResponder)2 AlertResponse (com.thinkbiganalytics.alerts.api.AlertResponse)2 SourceAlert (com.thinkbiganalytics.alerts.api.SourceAlert)2 AlertManager (com.thinkbiganalytics.alerts.spi.AlertManager)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ID (com.thinkbiganalytics.alerts.api.Alert.ID)1 AlertCriteria (com.thinkbiganalytics.alerts.api.AlertCriteria)1 AlertListener (com.thinkbiganalytics.alerts.api.AlertListener)1 AlertProvider (com.thinkbiganalytics.alerts.api.AlertProvider)1 AlertSummary (com.thinkbiganalytics.alerts.api.AlertSummary)1 AlertNotifyReceiver (com.thinkbiganalytics.alerts.spi.AlertNotifyReceiver)1 AlertSource (com.thinkbiganalytics.alerts.spi.AlertSource)1 AlertSourceAggregator (com.thinkbiganalytics.alerts.spi.AlertSourceAggregator)1 Serializable (java.io.Serializable)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 Proxy (java.lang.reflect.Proxy)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1 ArrayList (java.util.ArrayList)1