You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2022/09/22 17:07:50 UTC

[incubator-streampipes] 02/02: rework input elements

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

bossenti pushed a commit to branch explore/websocket-adapter
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 102d11dc10ce2993bb657579f22a53756e93669d
Author: bossenti <bo...@posteo.de>
AuthorDate: Thu Sep 22 19:07:36 2022 +0200

    rework input elements
---
 .../iiot/protocol/stream/websocket/WebsocketAdapter.java       | 10 +++++-----
 .../strings.en                                                 |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/websocket/WebsocketAdapter.java b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/websocket/WebsocketAdapter.java
index afb1e813f..fe9e47dc4 100644
--- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/websocket/WebsocketAdapter.java
+++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/java/org/apache/streampipes/connect/iiot/protocol/stream/websocket/WebsocketAdapter.java
@@ -43,7 +43,7 @@ public class WebsocketAdapter extends BrokerProtocol {
 
     public static final String ID = "org.apache.streampipes.connect.iiot.protocol.stream.websocket";
 
-    public static final String URI_KEY = "uri";
+    public static final String DEVICE_ID = "device-id";
     public static final String AUTH_KEY = "auth-key";
     public static final String MESSAGE_TYPE = "message-type";
     public static final String TEMPERATURE = "temperature-alternative";
@@ -66,14 +66,14 @@ public class WebsocketAdapter extends BrokerProtocol {
         StaticPropertyExtractor extractor =
                 StaticPropertyExtractor.from(protocolDescription.getConfig(), new ArrayList<>());
 
-        String uri = extractor.singleValueParameter(URI_KEY, String.class);
+        String deviceId = extractor.singleValueParameter(DEVICE_ID, String.class);
         String authToken = extractor.secretValue(AUTH_KEY);
         String selectedMessageType = extractor.selectedAlternativeInternalId(MESSAGE_TYPE);
 
         if (selectedMessageType.equals(TEMPERATURE)) {
-            return new WebsocketAdapter(parser, format, uri, authToken, "temperature");
+            return new WebsocketAdapter(parser, format, "wss://cubebroker.dashboard.inocube.inovex.io/ws?subscribe_to=" + deviceId, authToken, "temperature");
         } else {
-            return new WebsocketAdapter(parser, format, uri, authToken, "euler");
+            return new WebsocketAdapter(parser, format, "wss://cubebroker.dashboard.inocube.inovex.io/ws?subscribe_to=" + deviceId, authToken, "euler");
         }
 
     }
@@ -85,7 +85,7 @@ public class WebsocketAdapter extends BrokerProtocol {
                 .withAssets(Assets.DOCUMENTATION, Assets.ICON)
                 .category(AdapterType.Generic, AdapterType.Manufacturing)
                 .sourceType(AdapterSourceType.STREAM)
-                .requiredTextParameter(Labels.withId(URI_KEY))
+                .requiredTextParameter(Labels.withId(DEVICE_ID))
                 .requiredSecret(Labels.withId(AUTH_KEY))
                 .requiredAlternatives(Labels.withId(MESSAGE_TYPE), Alternatives.from(Labels.withId(TEMPERATURE)), Alternatives.from(Labels.withId(EULER)))
                 .build();
diff --git a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.websocket/strings.en b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.websocket/strings.en
index 2e601a5e6..6020dce29 100644
--- a/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.websocket/strings.en
+++ b/streampipes-extensions/streampipes-connect-adapters-iiot/src/main/resources/org.apache.streampipes.connect.iiot.protocol.stream.websocket/strings.en
@@ -1,8 +1,8 @@
 org.apache.streampipes.connect.iiot.protocol.stream.websocket.title=inoCube Websocket
 org.apache.streampipes.connect.iiot.protocol.stream.websocket.description=Consumes messages from the inoCube via a Websocket connection
 
-uri.title=Websocket URI
-uri.description=Example: ws://localhost:3333
+device-id.title=Device Id
+device-id.description=Device Id of the inoCube
 
 auth-key.title=Authentication Token
 auth-key.description=Token to authenticate against Azure Websocket