This is an automated email from the ASF dual-hosted git repository.

wiener pushed a commit to branch edge-extensions
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/edge-extensions by this push:
     new bbdd186  current work on event stream relay
bbdd186 is described below

commit bbdd18617748a54a7fac4ff1c6895628d556091e
Author: Patrick Wiener <[email protected]>
AuthorDate: Tue Jul 14 22:41:52 2020 +0200

    current work on event stream relay
---
 .../apache/streampipes/messaging/EventRelay.java   |  35 ++++++
 streampipes-node-controller-container/pom.xml      |  31 ++++-
 .../container/api/NodeControllerResource.java      |  48 +++++++-
 .../controller/container/config/ConfigKeys.java    |   2 +
 .../container/config/NodeControllerConfig.java     |   8 +-
 .../management/pe/PipelineElementManager.java      |   4 +
 .../management/relay/AbstractMqttKafkaBridge.java  | 105 +++++++++++++++++
 .../relay/AbstractMqttKafkaConnector.java          |  95 +++++++++++++++
 .../management/relay/AbstractMqttKafkaRelay.java   | 121 +++++++++++++++++++
 .../management/relay/EventRelayManager.java        | 113 ++++++++++++++++++
 .../management/relay/MqttKafkaBridge.java          | 129 +++++++++++++++++++++
 .../management/relay/RunningRelayInstances.java    |  45 +++++++
 .../container/management/relay/model/Metrics.java  |  50 ++++++++
 .../container/management/relay/model/Relay.java    |  61 ++++++++++
 .../http/InvocableEntityUrlGenerator.java          |  18 +--
 .../wrapper/siddhi/engine/SiddhiEventEngine.java   |  24 +++-
 .../save-pipeline/save-pipeline.controller.ts      |   5 +
 17 files changed, 877 insertions(+), 17 deletions(-)

diff --git 
a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventRelay.java
 
b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventRelay.java
new file mode 100644
index 0000000..43f3083
--- /dev/null
+++ 
b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/EventRelay.java
@@ -0,0 +1,35 @@
+package org.apache.streampipes.messaging;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import org.apache.streampipes.model.grounding.TransportProtocol;
+
+import java.io.Serializable;
+
+public interface EventRelay<TP1, TP2 extends TransportProtocol> extends 
Serializable {
+
+    void subscribe(TP1 sourceProtocol, TP2 targetProtocol) throws 
SpRuntimeException;
+
+    void publish(byte[] event);
+
+    void disconnect() throws SpRuntimeException;
+
+    Boolean isSourceConnected();
+
+    Boolean isTargetConnected();
+}
diff --git a/streampipes-node-controller-container/pom.xml 
b/streampipes-node-controller-container/pom.xml
index 50804a6..036e1b7 100644
--- a/streampipes-node-controller-container/pom.xml
+++ b/streampipes-node-controller-container/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>streampipes-parent</artifactId>
         <groupId>org.apache.streampipes</groupId>
-        <version>0.65.1-SNAPSHOT</version>
+        <version>0.67.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -32,22 +32,27 @@
         <dependency>
             <groupId>org.apache.streampipes</groupId>
             <artifactId>streampipes-container-base</artifactId>
-            <version>0.65.1-SNAPSHOT</version>
+            <version>0.67.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.streampipes</groupId>
             <artifactId>streampipes-container</artifactId>
-            <version>0.65.1-SNAPSHOT</version>
+            <version>0.67.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.streampipes</groupId>
             <artifactId>streampipes-config</artifactId>
-            <version>0.65.1-SNAPSHOT</version>
+            <version>0.67.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.streampipes</groupId>
             <artifactId>streampipes-model</artifactId>
-            <version>0.65.1-SNAPSHOT</version>
+            <version>0.67.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-messaging</artifactId>
+            <version>0.67.0-SNAPSHOT</version>
         </dependency>
 
         <!--external dependencies-->
@@ -71,6 +76,22 @@
             <artifactId>oshi-core</artifactId>
             <version>4.1.1</version>
         </dependency>
+        <dependency>
+            <groupId>org.eclipse.paho</groupId>
+            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
+            <version>1.2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.kafka</groupId>
+            <artifactId>kafka-clients</artifactId>
+            <version>2.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-messaging-kafka</artifactId>
+            <version>0.67.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/api/NodeControllerResource.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/api/NodeControllerResource.java
index a431933..4f9947f 100644
--- 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/api/NodeControllerResource.java
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/api/NodeControllerResource.java
@@ -16,6 +16,7 @@ package 
org.apache.streampipes.node.controller.container.api;/*
  *
  */
 
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
 import org.apache.streampipes.container.transform.Transformer;
 import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
 import org.apache.streampipes.model.graph.DataProcessorInvocation;
@@ -23,6 +24,9 @@ import org.apache.streampipes.model.graph.DataSinkInvocation;
 import org.apache.streampipes.model.node.PipelineElementDockerContainer;
 import 
org.apache.streampipes.node.controller.container.management.container.DockerOrchestratorManager;
 import 
org.apache.streampipes.node.controller.container.management.pe.PipelineElementManager;
+import 
org.apache.streampipes.node.controller.container.management.relay.EventRelayManager;
+import 
org.apache.streampipes.node.controller.container.management.relay.RunningRelayInstances;
+import org.eclipse.paho.client.mqttv3.MqttException;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
@@ -80,12 +84,19 @@ public class NodeControllerResource<I extends 
InvocableStreamPipesEntity> {
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     public Response invokePipelineElement(@PathParam("identifier") String 
identifier, @PathParam("elementId") String elementId, String payload) {
+
         // TODO implement
         String pipelineElementEndpoint;
         InvocableStreamPipesEntity graph;
         try {
             if (identifier.equals("sepa")) {
                 graph = Transformer.fromJsonLd(DataProcessorInvocation.class, 
payload);
+
+                // TODO: start event relay to remote broker
+//                EventRelayManager eventRelayManager = new 
EventRelayManager(graph);
+//                eventRelayManager.start();
+//                
RunningRelayInstances.INSTANCE.addRelay(eventRelayManager.getRelayedTopic(), 
eventRelayManager);
+
                 pipelineElementEndpoint = graph.getBelongsTo();
                 
PipelineElementManager.getInstance().invokePipelineElement(pipelineElementEndpoint,
 payload);
             }
@@ -108,8 +119,13 @@ public class NodeControllerResource<I extends 
InvocableStreamPipesEntity> {
     @Path("/detach")
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
-    public Response detachPipelineElement(String appId) {
+    public Response detachPipelineElement(String appId) throws 
SpRuntimeException {
         // TODO implement
+
+        // TODO: stop event relay to remote broker
+        EventRelayManager relay = 
RunningRelayInstances.INSTANCE.removeRelay(appId);
+        relay.stop();
+
         return Response
                 .ok()
                 .build();
@@ -124,4 +140,34 @@ public class NodeControllerResource<I extends 
InvocableStreamPipesEntity> {
                 .ok(DockerOrchestratorManager.getInstance().remove(container))
                 .build();
     }
+
+    // TODO: Debug-only.
+    @POST
+    @Path("/relay/start")
+    public Response debugRelayEventStream(String msg) throws 
SpRuntimeException {
+        // TODO implement
+
+        System.out.println(msg);
+        EventRelayManager eventRelayManager = new EventRelayManager();
+        eventRelayManager.start();
+        
RunningRelayInstances.INSTANCE.addRelay(eventRelayManager.getRelayedTopic(), 
eventRelayManager);
+
+        return Response
+                .ok()
+                .build();
+    }
+
+    @POST
+    @Path("/relay/stop")
+    public Response debugStopRelayEventStream(String msg) throws 
SpRuntimeException {
+        // TODO implement
+
+        System.out.println(msg);
+        EventRelayManager eventRelayManager = 
RunningRelayInstances.INSTANCE.get("org.apache.streampipes.flowrate01");
+        eventRelayManager.stop();
+
+        return Response
+                .ok()
+                .build();
+    }
 }
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/ConfigKeys.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/ConfigKeys.java
index 7ff0e2a..1335ee6 100644
--- 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/ConfigKeys.java
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/ConfigKeys.java
@@ -31,4 +31,6 @@ public class ConfigKeys {
     final static String NODE_SUPPORTED_PE_APP_ID_KEY = 
"SP_NODE_SUPPORTED_PE_APP_ID";
     final static String DOCKER_PRUNING_FREQ_SECS_KEY = 
"SP_DOCKER_PRUNING_FREQ_SECS";
     final static String NODE_RESOURCE_UPDATE_FREQ_SECS_KEY = 
"SP_NODE_RESOURCE_UPDATE_FREQ_SECS";
+
+    final static String NODE_EVENT_BUFFER_SIZE = "SP_NODE_EVENT_BUFFER_SIZE";
 }
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/NodeControllerConfig.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/NodeControllerConfig.java
index 03a6d14..4f9e32f 100644
--- 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/NodeControllerConfig.java
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/config/NodeControllerConfig.java
@@ -41,6 +41,7 @@ public enum NodeControllerConfig {
     // Node controller configs
     private static final int DEFAULT_DOCKER_PRUNING_FREQ_SECS = 60;
     private static final int DEFAULT_NODE_RESOURCE_UPDATE_FREQ_SECS = 30;
+    private static final int DEFAULT_EVENT_BUFFER_SIZE = 1000;
 
     NodeControllerConfig() {
         config = SpConfig.getSpConfig(node_service_id + SLASH + 
getNodeHostName());
@@ -54,12 +55,10 @@ public enum NodeControllerConfig {
 
     }
 
-
     public String getNodeServiceId() {
         return node_service_id;
     }
 
-
     /**
      *
      * @return node host name (physical DNS name or IP)
@@ -195,6 +194,11 @@ public enum NodeControllerConfig {
                 DEFAULT_NODE_RESOURCE_UPDATE_FREQ_SECS;
     }
 
+    public int getEventBufferSize() {
+        return envExist(ConfigKeys.NODE_EVENT_BUFFER_SIZE) ? 
getEnvAsInteger(ConfigKeys.NODE_EVENT_BUFFER_SIZE) :
+                DEFAULT_EVENT_BUFFER_SIZE;
+    }
+
     private boolean envExist(String key) {
         return System.getenv(key) != null;
     }
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/pe/PipelineElementManager.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/pe/PipelineElementManager.java
index ce9452a..5c41916 100644
--- 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/pe/PipelineElementManager.java
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/pe/PipelineElementManager.java
@@ -73,5 +73,9 @@ public class PipelineElementManager {
     /**
      * detaches pipeline elements when pipeline is stopped
      */
+    // TODO: implement detach pe logic
+    public void detachPipelineElement() {
+
+    }
 
 }
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaBridge.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaBridge.java
new file mode 100644
index 0000000..af15274
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaBridge.java
@@ -0,0 +1,105 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import com.google.gson.Gson;
+import org.apache.streampipes.messaging.kafka.SpKafkaProducer;
+import 
org.apache.streampipes.node.controller.container.config.NodeControllerConfig;
+import org.eclipse.paho.client.mqttv3.*;
+import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.*;
+
+
+public abstract class AbstractMqttKafkaBridge implements MqttCallback {
+    private final static Logger LOG = 
LoggerFactory.getLogger(AbstractMqttKafkaBridge.class);
+
+    private final String topic;
+
+    public final int qos = 1;
+    public final int EVENT_BUFFER_SIZE = 
NodeControllerConfig.INSTANCE.getEventBufferSize();
+    public final ArrayList<byte[]> eventBuffer = new ArrayList<>();
+    public int numDroppedEvents = 0;
+    public int numRelayedEvents = 0;
+    public boolean buffering = false;
+    public SpKafkaProducer producer;
+    public MqttClient mqttClient;
+    private long timeRelayStarted;
+
+    public AbstractMqttKafkaBridge(String topic, String mqttUrl, String 
kafkaUrl) {
+        this.topic = topic;
+        this.producer = new SpKafkaProducer(kafkaUrl, topic);
+        try {
+            this.mqttClient = new MqttClient(mqttUrl,"relay-" + 
UUID.randomUUID(), new MemoryPersistence());
+            this.mqttClient.setCallback(this);
+        } catch (MqttException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    public void start() throws MqttException {
+        timeRelayStarted = System.currentTimeMillis();
+        mqttClient.connect();
+        mqttClient.subscribe(topic, qos);
+    }
+
+    public void close() throws MqttException {
+        eventBuffer.clear();
+        mqttClient.disconnect();
+        producer.disconnect();
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public String getStats() {
+        Gson gson = new Gson();
+        Map<String, Object> m = new HashMap<>();
+        m.put("id", topic);
+        m.put("startedAt", timeRelayStarted);
+        m.put("numRelayedEvents", numRelayedEvents);
+        return gson.toJson(m);
+    }
+
+
+//    private KafkaProducer<Long, String> createKafkaProducer() {
+//        Properties props = new Properties();
+//        props.put(BOOTSTRAP_SERVERS_CONFIG, kafkaUri);
+//        // exactly-once
+////        props.put("enable.idempotence", "true");
+////        props.put("transactional.id", "prod-" + UUID.randomUUID());
+//        props.put(ACKS_CONFIG, "all");
+//        //props.put(RETRIES_CONFIG, 3);
+//        props.put(REQUEST_TIMEOUT_MS_CONFIG, 2000);
+//        props.put(MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, 1);
+//        // TODO: tune batch size and linger ms to suit use case of potential 
far away broker
+//        // higher batch size/linger results in higher throughput
+//        props.put(BATCH_SIZE_CONFIG, 16384);
+//        props.put(LINGER_MS_CONFIG, 20);
+//        props.put(BUFFER_MEMORY_CONFIG, 33554432);
+//        props.put(KEY_SERIALIZER_CLASS_CONFIG, 
LongSerializer.class.getName());
+//        props.put(VALUE_SERIALIZER_CLASS_CONFIG, 
StringSerializer.class.getName());
+//
+//        return new KafkaProducer<Long, String>(props);
+//    }
+
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaConnector.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaConnector.java
new file mode 100644
index 0000000..1d59eb3
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaConnector.java
@@ -0,0 +1,95 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import com.google.gson.Gson;
+import org.apache.streampipes.messaging.kafka.SpKafkaProducer;
+import org.apache.streampipes.model.grounding.KafkaTransportProtocol;
+import org.apache.streampipes.model.grounding.MqttTransportProtocol;
+import 
org.apache.streampipes.node.controller.container.management.relay.model.Metrics;
+import 
org.apache.streampipes.node.controller.container.management.relay.model.Relay;
+import org.eclipse.paho.client.mqttv3.*;
+import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.UUID;
+
+public abstract class AbstractMqttKafkaConnector {
+
+    private final String MQTT_PROTOCOL = "tcp://";
+    private final String COLON = ":";
+    private final String MQTT_CLIENT_ID = String.valueOf(UUID.randomUUID());
+    private final int SOCKET_TIMEOUT = 500;
+
+    protected SpKafkaProducer producer;
+    protected IMqttClient consumer;
+    protected Boolean isMqttConnected = false;
+    protected Boolean isKafkaConnected = false;
+
+    protected Metrics metrics;
+    protected Relay relay;
+
+    protected void createBrokerConnection(MqttTransportProtocol 
sourceProtocol, KafkaTransportProtocol targetProtocol) {
+        String sourceUrl = makeMqttBrokerUrl(sourceProtocol);
+        String targetUrl = makeKafkaBrokerUrl(targetProtocol);
+        String topic = extractTopic(sourceProtocol);
+
+        this.metrics = new Metrics(topic);
+        this.relay = new Relay(sourceProtocol.getBrokerHostname(), 
sourceProtocol.getPort(), targetProtocol.getBrokerHostname(), 
targetProtocol.getKafkaPort(), topic);
+        try {
+            this.producer = new SpKafkaProducer(targetUrl, topic);
+            this.producer.connect(targetProtocol);
+            this.consumer = new MqttClient(sourceUrl, MQTT_CLIENT_ID, new 
MemoryPersistence());
+            this.consumer.connect();
+        } catch (MqttException e) {
+            e.printStackTrace();
+        }
+
+        this.isKafkaConnected = true;
+        this.isMqttConnected = true;
+    }
+
+    public String extractTopic(MqttTransportProtocol mqttProtocol) {
+        return mqttProtocol.getTopicDefinition().getActualTopicName();
+    }
+
+    private String makeMqttBrokerUrl(MqttTransportProtocol mqttProtocol) {
+        return MQTT_PROTOCOL + mqttProtocol.getBrokerHostname() + COLON + 
mqttProtocol.getPort();
+    }
+
+    private String makeKafkaBrokerUrl(KafkaTransportProtocol kafkaProtocol) {
+        return kafkaProtocol.getBrokerHostname() + COLON + 
kafkaProtocol.getKafkaPort();
+    }
+
+    public String getMetrics() {
+        return new Gson().toJson(metrics);
+    }
+
+    public boolean isKafkaAlive() {
+        boolean isAlive = true;
+        try{
+            InetSocketAddress sa = new 
InetSocketAddress(relay.getTargetHost(), relay.getTargetPort());
+            Socket ss = new Socket();
+            ss.connect(sa, SOCKET_TIMEOUT);
+            ss.close();
+        }catch(Exception e) {
+            isAlive = false;
+        }
+        return isAlive;
+    }
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaRelay.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaRelay.java
new file mode 100644
index 0000000..41ff66d
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/AbstractMqttKafkaRelay.java
@@ -0,0 +1,121 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.kafka.common.KafkaException;
+import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
+import org.eclipse.paho.client.mqttv3.MqttMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+public class AbstractMqttKafkaRelay extends AbstractMqttKafkaBridge {
+    private final static Logger LOG = 
LoggerFactory.getLogger(AbstractMqttKafkaRelay.class);
+
+    private final String kafkaUrl;
+
+    public AbstractMqttKafkaRelay(String topic, String mqttUrl, String 
kafkaUrl) {
+        super(topic, mqttUrl, kafkaUrl);
+        this.kafkaUrl = kafkaUrl;
+    }
+
+    @Override
+    public void connectionLost(Throwable throwable) {
+        LOG.info("Connection lost because: {}", throwable.toString());
+        System.exit(1);
+    }
+
+    @Override
+    public void messageArrived(String s, MqttMessage mqttMessage) throws 
Exception {
+
+        byte[] event = mqttMessage.getPayload();
+
+        // Check if Kafka is reachable
+        // If Kafka is not reachable buffer events in temporary record buffer
+        // TODO: isServiceReachable should run independant of callback
+        if(isKafkaAlive()) {
+            if (eventBuffer.isEmpty()) {
+                // send events to upstream
+                try{
+                    producer.publish(event);
+                    numRelayedEvents++;
+                }  catch( KafkaException e ) {
+                    LOG.error("Kafka exception: {}", e);
+                }
+                //this.totalRelayedEventsSize = this.totalRelayedEventsSize + 
event.getBytes(StandardCharsets.UTF_8).length;
+            }
+            else {
+                // TODO: send buffered event should run independant of callback
+                // send buffered events & clear buffer
+                LOG.info("Connection re-established. Send events from 
temporary buffer for opic={} (send={}, dropped={})", getTopic(), 
eventBuffer.size(), numDroppedEvents);
+
+                // add current event from callback
+                eventBuffer.add(event);
+                eventBuffer.forEach(e -> {
+                    try{
+                        producer.publish(e);
+                        numRelayedEvents++;
+                    }  catch( KafkaException ke ) {
+                        LOG.error("Kafka exception: {}", ke);
+                    }
+                });
+                eventBuffer.clear();
+                numDroppedEvents = 0;
+                buffering = false;
+            }
+        }
+        else {
+            // add event to buffer
+            if(!buffering) {
+                LOG.info("Connection issue. Temporarily store event in buffer 
for topic={}", getTopic());
+                buffering = true;
+            }
+
+            if (eventBuffer.size() != EVENT_BUFFER_SIZE) {
+                eventBuffer.add(event);
+            }
+            else {
+                // evict oldest event
+                eventBuffer.remove(0);
+                numDroppedEvents++;
+            }
+        }
+    }
+
+    @Override
+    public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
+
+    }
+
+    public boolean isKafkaAlive() {
+        String ip = kafkaUrl.split(":")[0];
+        int port = Integer.parseInt(kafkaUrl.split(":")[1]);
+        boolean connectivity = true;
+        try{
+            InetSocketAddress sa = new InetSocketAddress(ip, port);
+            Socket ss = new Socket();
+            ss.connect(sa, 50);
+            ss.close();
+        }catch(Exception e) {
+            connectivity = false;
+        }
+        return connectivity;
+    }
+
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/EventRelayManager.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/EventRelayManager.java
new file mode 100644
index 0000000..d3a7af5
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/EventRelayManager.java
@@ -0,0 +1,113 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
+import org.apache.streampipes.model.grounding.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EventRelayManager {
+    private final static Logger LOG = 
LoggerFactory.getLogger(EventRelayManager.class);
+
+    private final String MQTT_PROTOCOL = "tcp://";
+    private final String MQTT_HOST = "localhost";
+    private final int MQTT_PORT = 1883;
+    private final String COLON = ":";
+
+    private final MqttKafkaBridge mqttKafkaBridge;
+    private final String relayedTopic;
+
+    private final MqttTransportProtocol sourceProtocol = new 
MqttTransportProtocol();
+    private final KafkaTransportProtocol targetProtocol = new 
KafkaTransportProtocol();
+
+    public EventRelayManager(InvocableStreamPipesEntity graph){
+        this.relayedTopic = extractTopic(graph);
+        this.mqttKafkaBridge = new MqttKafkaBridge();
+
+        // TODO: only for debugging
+        createDebugTransportProtocol();
+    }
+
+    public EventRelayManager() {
+        this.relayedTopic = "org.apache.streampipes.flowrate01";
+        this.mqttKafkaBridge = new MqttKafkaBridge();
+        createDebugTransportProtocol();
+    }
+
+    private String getMqttUrl() {
+        return MQTT_PROTOCOL + MQTT_HOST + COLON + MQTT_PORT;
+    }
+
+    public void start() throws SpRuntimeException{
+        LOG.info("Start event relay for topic: {}", relayedTopic);
+        mqttKafkaBridge.subscribe(sourceProtocol, targetProtocol);
+    }
+
+    // TODO: only for debugging
+    private void createDebugTransportProtocol() {
+        sourceProtocol.setBrokerHostname(MQTT_HOST);
+        sourceProtocol.setPort(MQTT_PORT);
+        sourceProtocol.setTopicDefinition(new TopicDefinition(relayedTopic) {
+            @Override
+            public void setActualTopicName(String actualTopicName) {
+                super.setActualTopicName(actualTopicName);
+            }
+        });
+        targetProtocol.setBrokerHostname("localhost");
+        targetProtocol.setKafkaPort(9094);
+        targetProtocol.setTopicDefinition(new TopicDefinition(relayedTopic) {
+            @Override
+            public void setActualTopicName(String actualTopicName) {
+                super.setActualTopicName(actualTopicName);
+            }
+        });
+    }
+
+    public void stop() throws SpRuntimeException{
+        LOG.info("Stop event relay for topic: {}", relayedTopic);
+        mqttKafkaBridge.disconnect();
+    }
+
+    public String metrics() {
+        LOG.info("Get current stats of event relay for topic: {}", 
relayedTopic);
+        return mqttKafkaBridge.getMetrics();
+    }
+
+    public String getRelayedTopic() {
+        return relayedTopic;
+    }
+
+    private String extractKafkaBroker(InvocableStreamPipesEntity graph) {
+        EventGrounding eventGrounding = getEventGrounding(graph);
+
+        String host = 
eventGrounding.getTransportProtocol().getBrokerHostname();
+        int port = ((KafkaTransportProtocol) 
eventGrounding.getTransportProtocol()).getKafkaPort();
+
+        return host + ":" + port;
+    }
+
+    private EventGrounding getEventGrounding(InvocableStreamPipesEntity graph) 
{
+        return graph.getSupportedGrounding();
+    }
+
+    private static String extractTopic(InvocableStreamPipesEntity graph) {
+        return 
graph.getSupportedGrounding().getTransportProtocol().getTopicDefinition().getActualTopicName();
+    }
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/MqttKafkaBridge.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/MqttKafkaBridge.java
new file mode 100644
index 0000000..755715c
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/MqttKafkaBridge.java
@@ -0,0 +1,129 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.kafka.common.KafkaException;
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import org.apache.streampipes.messaging.EventRelay;
+import org.apache.streampipes.model.grounding.KafkaTransportProtocol;
+import org.apache.streampipes.model.grounding.MqttTransportProtocol;
+import 
org.apache.streampipes.node.controller.container.config.NodeControllerConfig;
+import org.eclipse.paho.client.mqttv3.MqttException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+
+
+public class MqttKafkaBridge extends AbstractMqttKafkaConnector implements 
EventRelay<MqttTransportProtocol, KafkaTransportProtocol> {
+    private final static Logger LOG = 
LoggerFactory.getLogger(MqttKafkaBridge.class);
+
+    private final int QOS_LEVEL= 1;
+    private final int EVENT_BUFFER_SIZE = 
NodeControllerConfig.INSTANCE.getEventBufferSize();
+
+    private final ArrayList<byte[]> eventBuffer = new ArrayList<>();
+
+    public boolean isBuffering = false;
+
+    public MqttKafkaBridge() {
+    }
+
+    @Override
+    public void subscribe(MqttTransportProtocol sourceProtocol, 
KafkaTransportProtocol targetProtocol) throws SpRuntimeException {
+        try {
+            this.createBrokerConnection(sourceProtocol, targetProtocol);
+            consumer.subscribe(extractTopic(sourceProtocol), QOS_LEVEL, 
(topic, msg) -> publish(msg.getPayload()));
+        } catch (Exception e) {
+            throw new SpRuntimeException(e);
+        }
+    }
+
+    @Override
+    public void publish(byte[] event) {
+        // check if Kafka host is alive
+        if(isKafkaAlive()) {
+            if (eventBuffer.isEmpty()) {
+                // send events to upstream
+                try{
+                    producer.publish(event);
+                    metrics.increaseNumRelayedEvents();
+                }  catch( KafkaException e ) {
+                    LOG.error(e.toString());
+                }
+            }
+            else {
+                // TODO: send buffered event should run independant of callback
+                // send buffered events & clear buffer
+                LOG.info("Connection re-established. Send events from 
temporary buffer for " +
+                        "topic={} (send={}, dropped={})", relay.getTopic(), 
eventBuffer.size(), metrics.getNumDroppedEvents());
+
+                // add current event from callback
+                eventBuffer.add(event);
+                eventBuffer.forEach(e -> {
+                    try{
+                        producer.publish(e);
+                        metrics.increaseNumRelayedEvents();
+                    }  catch( KafkaException ke ) {
+                        LOG.error(ke.toString());
+                    }
+                });
+                eventBuffer.clear();
+                metrics.clearNumDroppedEvents();
+                isBuffering = false;
+            }
+        }
+        else {
+            // add event to buffer
+            if(!isBuffering) {
+                LOG.info("Connection issue. Temporarily store event in buffer 
for topic={}", relay.getTopic());
+                isBuffering = true;
+            }
+
+            if (eventBuffer.size() != EVENT_BUFFER_SIZE) {
+                eventBuffer.add(event);
+            }
+            else {
+                // evict oldest event
+                eventBuffer.remove(0);
+                metrics.increaseNumDroppedEvents();
+            }
+        }
+    }
+
+    @Override
+    public void disconnect() throws SpRuntimeException {
+        try {
+            this.consumer.disconnect();
+            this.producer.disconnect();
+        } catch (MqttException e) {
+            e.printStackTrace();
+        } finally {
+            this.isMqttConnected = false;
+            this.isKafkaConnected = false;
+        }
+    }
+
+    @Override
+    public Boolean isSourceConnected() {
+        return this.isMqttConnected;
+    }
+
+    @Override
+    public Boolean isTargetConnected() {
+        return this.isKafkaConnected;
+    }
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/RunningRelayInstances.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/RunningRelayInstances.java
new file mode 100644
index 0000000..276f488
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/RunningRelayInstances.java
@@ -0,0 +1,45 @@
+package org.apache.streampipes.node.controller.container.management.relay;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum RunningRelayInstances {
+    INSTANCE;
+
+    private final Map<String, EventRelayManager> runningInstances = new 
HashMap<>();
+
+    // TODO: persist active relays to support failure handling
+    public void addRelay(String id, EventRelayManager eventRelayManager) {
+        runningInstances.put(id, eventRelayManager);
+    }
+
+    public boolean isRunning(String id) {
+        return runningInstances.get(id) != null;
+    }
+
+    public EventRelayManager get(String id) {
+        return isRunning(id) ? runningInstances.get(id) : null;
+    }
+
+    public EventRelayManager removeRelay(String id) {
+        EventRelayManager eventRelayManager = runningInstances.get(id);
+        runningInstances.remove(id);
+        return eventRelayManager;
+    }
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Metrics.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Metrics.java
new file mode 100644
index 0000000..621be48
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Metrics.java
@@ -0,0 +1,50 @@
+package 
org.apache.streampipes.node.controller.container.management.relay.model;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+public class Metrics {
+
+    private final long timeStarted;
+    private final String id;
+    private long numRelayedEvents = 0;
+    private long numDroppedEvents = 0;
+
+    public Metrics(String id) {
+        this.timeStarted = System.currentTimeMillis();
+        this.id = id;
+    }
+
+    public long getNumRelayedEvents() {
+        return numRelayedEvents;
+    }
+
+    public void increaseNumRelayedEvents() {
+        this.numRelayedEvents++;
+    }
+
+    public long getNumDroppedEvents() {
+        return numDroppedEvents;
+    }
+
+    public void increaseNumDroppedEvents() {
+        this.numDroppedEvents++;
+    }
+
+    public void clearNumDroppedEvents() {
+        this.numDroppedEvents = 0;
+    }
+}
diff --git 
a/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Relay.java
 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Relay.java
new file mode 100644
index 0000000..9a90aca
--- /dev/null
+++ 
b/streampipes-node-controller-container/src/main/java/org/apache/streampipes/node/controller/container/management/relay/model/Relay.java
@@ -0,0 +1,61 @@
+package 
org.apache.streampipes.node.controller.container.management.relay.model;/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+public class Relay {
+    private final String sourceHost;
+    private final int sourcePort;
+    private final String targetHost;
+    private final int targetPort;
+    private final String topic;
+
+    public Relay(String sourceUrl, String targetUrl, String topic) {
+        this.sourceHost = sourceUrl.split(":")[0];
+        this.sourcePort = Integer.parseInt(sourceUrl.split(":")[1]);
+        this.targetHost = targetUrl.split(":")[0];
+        this.targetPort = Integer.parseInt(targetUrl.split(":")[1]);
+        this.topic = topic;
+    }
+
+    public Relay(String sourceHost, int sourcePort, String targetHost, int 
targetPort, String topic) {
+        this.sourceHost = sourceHost;
+        this.sourcePort = sourcePort;
+        this.targetHost = targetHost;
+        this.targetPort = targetPort;
+        this.topic = topic;
+    }
+
+    public String getSourceHost() {
+        return sourceHost;
+    }
+
+    public int getSourcePort() {
+        return sourcePort;
+    }
+
+    public String getTargetHost() {
+        return targetHost;
+    }
+
+    public int getTargetPort() {
+        return targetPort;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+}
diff --git 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/InvocableEntityUrlGenerator.java
 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/InvocableEntityUrlGenerator.java
index 80231bc..8fe3a4b 100644
--- 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/InvocableEntityUrlGenerator.java
+++ 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/execution/http/InvocableEntityUrlGenerator.java
@@ -41,20 +41,22 @@ public class InvocableEntityUrlGenerator extends 
EndpointUrlGenerator<InvocableS
 
     @Override
     public String generateStartPipelineEndpointUrl() {
-//        return URLPREFIX
-//                + getHost()
-//                + SLASH
-//                + getIdentifier()
-//                + SLASH
-//                + pipelineElement.getAppId();
+        // TODO: normal setup
         return URLPREFIX
                 + getHost()
                 + SLASH
-                + "node/container/invoke"
-                + SLASH
                 + getIdentifier()
                 + SLASH
                 + pipelineElement.getAppId();
+        // TODO: uncomment for edge tests
+//        return URLPREFIX
+//                + getHost()
+//                + SLASH
+//                + "node/container/invoke"
+//                + SLASH
+//                + getIdentifier()
+//                + SLASH
+//                + pipelineElement.getAppId();
     }
 
     @Override
diff --git 
a/streampipes-wrapper-siddhi/src/main/java/org/apache/streampipes/wrapper/siddhi/engine/SiddhiEventEngine.java
 
b/streampipes-wrapper-siddhi/src/main/java/org/apache/streampipes/wrapper/siddhi/engine/SiddhiEventEngine.java
index 15bd0db..ac9366f 100644
--- 
a/streampipes-wrapper-siddhi/src/main/java/org/apache/streampipes/wrapper/siddhi/engine/SiddhiEventEngine.java
+++ 
b/streampipes-wrapper-siddhi/src/main/java/org/apache/streampipes/wrapper/siddhi/engine/SiddhiEventEngine.java
@@ -34,6 +34,10 @@ import io.siddhi.core.event.Event;
 import io.siddhi.core.stream.input.InputHandler;
 import io.siddhi.core.stream.output.StreamCallback;
 
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.util.*;
 
 public abstract class SiddhiEventEngine<B extends EventProcessorBindingParams> 
implements
@@ -51,6 +55,8 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
   private Boolean debugMode;
   private SiddhiDebugCallback debugCallback;
 
+  private String timestampField;
+
   private static final Logger LOG = 
LoggerFactory.getLogger(SiddhiEventEngine.class);
 
   public SiddhiEventEngine() {
@@ -76,6 +82,7 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
 
     SiddhiManager siddhiManager = SpSiddhiManager.INSTANCE.getSiddhiManager();
 
+    this.timestampField = 
removeStreamIdFromTimestamp(setTimestamp(parameters));
 
     LOG.info("Configuring event types for graph " + 
parameters.getGraph().getName());
     parameters.getInEventTypes().forEach((key, value) -> {
@@ -125,6 +132,10 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
 
   }
 
+  private String removeStreamIdFromTimestamp(String timestampField) {
+    return timestampField !=null ? timestampField.replaceAll("s0::", "") : 
null;
+  }
+
   private String getOutputTopicName(B parameters) {
     return parameters
             .getGraph()
@@ -163,7 +174,13 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
     }
 
     for (String key : sortedEventKeys) {
-      joiner.add("s0" + key + " " + toType((Class<?>) typeMap.get(key)));
+      // TODO: get timestamp field from user params
+      if(key.equalsIgnoreCase(this.timestampField)) {
+        joiner.add("s0" + key + " LONG");
+      }
+      else {
+        joiner.add("s0" + key + " " + toType((Class<?>) typeMap.get(key)));
+      }
     }
 
     this.siddhiAppString.append(defineStreamPrefix);
@@ -228,6 +245,10 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
 
   protected abstract String selectStatement(final B bindingParameters);
 
+  protected String setTimestamp(final B bindingparameters) {
+    return null;
+  }
+
   protected String prepareName(String eventName) {
     return eventName
             .replaceAll("\\.", "")
@@ -236,6 +257,7 @@ public abstract class SiddhiEventEngine<B extends 
EventProcessorBindingParams> i
   }
 
 
+
   protected String getCustomOutputSelectStatement(DataProcessorInvocation 
invocation,
                                                   String eventName) {
     StringBuilder selectString = new StringBuilder();
diff --git a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.controller.ts 
b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.controller.ts
index 1b830e5..839d3d0 100644
--- a/ui/src/app/editor/dialog/save-pipeline/save-pipeline.controller.ts
+++ b/ui/src/app/editor/dialog/save-pipeline/save-pipeline.controller.ts
@@ -18,6 +18,8 @@
 
 import {RestApi} from "../../../services/rest-api.service";
 import {NodeInfo, NodeMetadata} from 
"../../../configuration/model/NodeInfo.model";
+import {Browser} from "leaflet";
+import edge = Browser.edge;
 
 export class SavePipelineController {
 
@@ -133,6 +135,9 @@ export class SavePipelineController {
         }
 
         let storageRequest;
+        this.pipeline.sepas;
+
+        console.log(this.pipeline);
 
         if (this.modificationMode && this.updateMode === 'update') {
             storageRequest = this.RestApi.updatePipeline(this.pipeline);

Reply via email to