From 2c2b47ab85b7a788ad2be3aecab1f8371e1cf13b Mon Sep 17 00:00:00 2001 From: Sujesh Menon <33488591+Menotron@users.noreply.github.com> Date: Mon, 4 Feb 2019 05:47:32 +0530 Subject: [PATCH] NIFI-5991 Added WebSockets schemes to the broker URI Validator MQTT over websockets uses ws (and wss for secure websocket connections) schemes in the broker URI. Added support for the same. Signed-off-by: Pierre Villard This closes #3289. --- .../nifi/processors/mqtt/common/AbstractMQTTProcessor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/AbstractMQTTProcessor.java b/nifi-nar-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/AbstractMQTTProcessor.java index 6a8fc7d67d..a1e65f33e7 100644 --- a/nifi-nar-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/AbstractMQTTProcessor.java +++ b/nifi-nar-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/AbstractMQTTProcessor.java @@ -87,8 +87,8 @@ public abstract class AbstractMQTTProcessor extends AbstractSessionFactoryProces if (!"".equals(brokerURI.getPath())) { return new ValidationResult.Builder().subject(subject).valid(false).explanation("the broker URI cannot have a path. It currently is:" + brokerURI.getPath()).build(); } - if (!("tcp".equals(brokerURI.getScheme()) || "ssl".equals(brokerURI.getScheme()))) { - return new ValidationResult.Builder().subject(subject).valid(false).explanation("only the 'tcp' and 'ssl' schemes are supported.").build(); + if (!("tcp".equals(brokerURI.getScheme()) || "ssl".equals(brokerURI.getScheme()) || "ws".equals(brokerURI.getScheme()) || "wss".equals(brokerURI.getScheme()))) { + return new ValidationResult.Builder().subject(subject).valid(false).explanation("only the 'tcp', 'ssl', 'ws' and 'wss' schemes are supported.").build(); } } catch (URISyntaxException e) { return new ValidationResult.Builder().subject(subject).valid(false).explanation("it is not valid URI syntax.").build(); @@ -113,7 +113,7 @@ public abstract class AbstractMQTTProcessor extends AbstractSessionFactoryProces public static final PropertyDescriptor PROP_BROKER_URI = new PropertyDescriptor.Builder() .name("Broker URI") - .description("The URI to use to connect to the MQTT broker (e.g. tcp://localhost:1883). The 'tcp' and 'ssl' schemes are supported. In order to use 'ssl', the SSL Context " + + .description("The URI to use to connect to the MQTT broker (e.g. tcp://localhost:1883). The 'tcp', 'ssl', 'ws' and 'wss' schemes are supported. In order to use 'ssl', the SSL Context " + "Service property must be set.") .required(true) .addValidator(BROKER_VALIDATOR)