You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/04/29 19:38:19 UTC
(streampipes) branch fix-nats-token-functions created (now 3d2ca8d19a)
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a change to branch fix-nats-token-functions
in repository https://gitbox.apache.org/repos/asf/streampipes.git
at 3d2ca8d19a fix: Add nats token to function output collector
This branch includes the following new commits:
new 3d2ca8d19a fix: Add nats token to function output collector
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(streampipes) 01/01: fix: Add nats token to function output collector
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a commit to branch fix-nats-token-functions
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 3d2ca8d19ae90106ba9a9e6c151e0e61f7e1e575
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Apr 29 21:37:56 2026 +0200
fix: Add nats token to function output collector
---
.../streampipes/messaging/ProtocolOverrides.java | 37 ++++++++++++++++++++++
.../standalone/function/StreamPipesFunction.java | 4 +++
.../standalone/manager/ProtocolManager.java | 18 ++---------
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/ProtocolOverrides.java b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/ProtocolOverrides.java
new file mode 100644
index 0000000000..efb0797c73
--- /dev/null
+++ b/streampipes-messaging/src/main/java/org/apache/streampipes/messaging/ProtocolOverrides.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.messaging;
+
+import org.apache.streampipes.commons.environment.Environments;
+import org.apache.streampipes.model.grounding.NatsTransportProtocol;
+import org.apache.streampipes.model.grounding.TransportProtocol;
+
+public class ProtocolOverrides {
+
+ public static void addNatsTokenIfConfigured(TransportProtocol protocol) {
+ if (protocol instanceof NatsTransportProtocol natsProtocol) {
+ var natsToken = Environments.getEnvironment().getNatsToken().getValueOrDefault();
+ if ((natsProtocol.getToken() == null || natsProtocol.getToken().isBlank())
+ && natsToken != null
+ && !natsToken.isBlank()) {
+ natsProtocol.setToken(natsToken);
+ }
+ }
+ }
+}
diff --git a/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/function/StreamPipesFunction.java b/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/function/StreamPipesFunction.java
index 591fe8cc33..82243f8981 100644
--- a/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/function/StreamPipesFunction.java
+++ b/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/function/StreamPipesFunction.java
@@ -28,9 +28,12 @@ import org.apache.streampipes.extensions.api.pe.routing.RawDataProcessor;
import org.apache.streampipes.extensions.api.pe.routing.SpInputCollector;
import org.apache.streampipes.extensions.api.pe.routing.SpOutputCollector;
import org.apache.streampipes.extensions.management.util.GroundingDebugUtils;
+import org.apache.streampipes.messaging.ProtocolOverrides;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.constants.PropertySelectorConstants;
import org.apache.streampipes.model.function.FunctionId;
+import org.apache.streampipes.model.grounding.NatsTransportProtocol;
+import org.apache.streampipes.model.grounding.TransportProtocol;
import org.apache.streampipes.model.monitoring.SpLogEntry;
import org.apache.streampipes.model.monitoring.SpLogMessage;
import org.apache.streampipes.model.runtime.Event;
@@ -166,6 +169,7 @@ public abstract class StreamPipesFunction implements IStreamPipesFunctionDeclare
if (getEnvironment().getSpDebug().getValueOrDefault()) {
GroundingDebugUtils.modifyGrounding(value.getEventGrounding());
}
+ ProtocolOverrides.addNatsTokenIfConfigured(value.getEventGrounding().getTransportProtocol());
this.outputCollectors.put(
uniqueStreamId,
ProtocolManager.makeOutputCollector(
diff --git a/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/manager/ProtocolManager.java b/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/manager/ProtocolManager.java
index a25579395b..bf86a4bfaf 100644
--- a/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/manager/ProtocolManager.java
+++ b/streampipes-wrapper-standalone/src/main/java/org/apache/streampipes/wrapper/standalone/manager/ProtocolManager.java
@@ -18,9 +18,8 @@
package org.apache.streampipes.wrapper.standalone.manager;
-import org.apache.streampipes.commons.environment.Environments;
import org.apache.streampipes.commons.exceptions.SpRuntimeException;
-import org.apache.streampipes.model.grounding.NatsTransportProtocol;
+import org.apache.streampipes.messaging.ProtocolOverrides;
import org.apache.streampipes.model.grounding.TransportProtocol;
import org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector;
import org.apache.streampipes.wrapper.standalone.routing.StandaloneSpOutputCollector;
@@ -44,7 +43,7 @@ public class ProtocolManager {
public static <T extends TransportProtocol> StandaloneSpInputCollector findInputCollector(T protocol,
Boolean singletonEngine)
throws SpRuntimeException {
- addNatsTokenIfConfigured(protocol);
+ ProtocolOverrides.addNatsTokenIfConfigured(protocol);
if (consumers.containsKey(topicName(protocol))) {
return consumers.get(topicName(protocol));
@@ -59,7 +58,7 @@ public class ProtocolManager {
public static <T extends TransportProtocol> StandaloneSpOutputCollector findOutputCollector(T protocol,
String resourceId)
throws SpRuntimeException {
- addNatsTokenIfConfigured(protocol);
+ ProtocolOverrides.addNatsTokenIfConfigured(protocol);
if (producers.containsKey(topicName(protocol))) {
return producers.get(topicName(protocol));
@@ -89,17 +88,6 @@ public class ProtocolManager {
return protocol.getTopicDefinition().getActualTopicName();
}
- private static void addNatsTokenIfConfigured(TransportProtocol protocol) {
- if (protocol instanceof NatsTransportProtocol natsProtocol) {
- var natsToken = Environments.getEnvironment().getNatsToken().getValueOrDefault();
- if ((natsProtocol.getToken() == null || natsProtocol.getToken().isBlank())
- && natsToken != null
- && !natsToken.isBlank()) {
- natsProtocol.setToken(natsToken);
- }
- }
- }
-
public static <T extends TransportProtocol> void removeInputCollector(T protocol) throws
SpRuntimeException {
consumers.remove(topicName(protocol));