1 package org.openkilda.wfm.ctrl;
3 import com.fasterxml.jackson.core.JsonProcessingException;
4 import com.google.common.base.Strings;
5 import org.apache.storm.tuple.Tuple;
13 import java.nio.file.FileSystem;
14 import java.nio.file.FileSystems;
15 import java.nio.file.Path;
16 import java.nio.file.PathMatcher;
17 import java.util.List;
21 private String topologyName;
22 private Map<String, String> endpoints;
26 String topologyName, Map<String, String> endpoint) {
29 this.topologyName = topologyName;
30 this.endpoints = endpoint;
40 "Skip foreign message (correlation-id: %s timestamp: %s)",
48 private void handleMessage(
CtrlRequest payload)
throws JsonProcessingException {
50 payload.getData(), payload.getCorrelationId(), topologyName);
51 List<Object> packedMessage = message.
pack();
53 String glob = payload.getRoute();
55 if (Strings.isNullOrEmpty(glob)) {
57 }
else if (glob.equals(
"*")) {
61 FileSystem fs = FileSystems.getDefault();
62 PathMatcher matcher = fs.getPathMatcher(
"glob:" + glob);
64 for (String bolt : endpoints.keySet()) {
65 Path route = fs.getPath(topologyName, bolt);
67 if (! matcher.matches(route)) {
72 endpoints.get(bolt),
getTuple(), packedMessage);
OutputCollector getOutputCollector()
RouteAction(IKildaBolt bolt, Tuple tuple, String topologyName, Map< String, String > endpoint)
String getCorrelationId()