Search in sources :

Example 6 with LifecycleEvent

use of org.openkilda.bluegreen.LifecycleEvent in project open-kilda by telstra.

the class ZooKeeperSpout method nextTuple.

@Override
public void nextTuple() {
    Signal signal = signals.poll();
    if (signal != null) {
        LifecycleEvent event = LifecycleEvent.builder().signal(signal).uuid(UUID.randomUUID()).messageId(messageId++).build();
        log.info("Component {} with id {} received signal {} from zookeeper. Sending event {}", serviceName, id, signal, event);
        collector.emit(new Values(event, new CommandContext()), messageId);
    } else {
        org.apache.storm.utils.Utils.sleep(1L);
    }
    if (!watchDog.isConnectedAndValidated()) {
        if (isZooKeeperConnectTimeoutPassed()) {
            log.info("Service {} with run_id {} tries to reconnect to ZooKeeper {}", serviceName, id, connectionString);
            watchDog.safeRefreshConnection();
            zooKeeperConnectionTimestamp = Instant.now();
        }
    }
}
Also used : Signal(org.openkilda.bluegreen.Signal) CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values) LifecycleEvent(org.openkilda.bluegreen.LifecycleEvent)

Aggregations

LifecycleEvent (org.openkilda.bluegreen.LifecycleEvent)6 Values (org.apache.storm.tuple.Values)3 CommandContext (org.openkilda.wfm.CommandContext)3 Tuple (org.apache.storm.tuple.Tuple)2 TupleImpl (org.apache.storm.tuple.TupleImpl)2 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Signal (org.openkilda.bluegreen.Signal)1 Datapoint (org.openkilda.messaging.info.Datapoint)1 DatapointEntries (org.openkilda.messaging.info.DatapointEntries)1 InfoData (org.openkilda.messaging.info.InfoData)1