Class ITER_MQTTSubscribe

  • All Implemented Interfaces:

    public class ITER_MQTTSubscribe
    extends IteratorStreamFunctionBase
    Iterator function iter:MQTTSubscribe connects to a MQTT server, subscribes to some topics, and issues bindings for the topic (first variable) and the message (second variable) when they are received.

    See Live example

    • Param 1: (a String or URL) the MQTT server. Two types of connection are supported tcp:// for a TCP connection and ssl:// for a TCP connection secured by SSL/TLS;
    • Param 2 .. n (optional, Strings): topics to subscribe to.

    For SSL configuration (programmatic or using JVM arguments), see the constructor of MqttClient.

    Additional connection OPTIONS configuration can be programmatically set using the MqttConnectOptions returned by getOptions().

    The MQTT message (byte[]) is assumed to be a UTF-8 string. This behaviour may may changed using setParser(java.util.function.Function<byte[], org.apache.jena.sparql.expr.NodeValue>) static method.

    Maxime Lefrançois
    • Field Summary

      Modifier and Type Field Description
      static org.eclipse.paho.client.mqttv3.MqttConnectOptions OPTIONS  
      static java.util.function.Function<byte[],​NodeValue> PARSER  
      static java.lang.String URI  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkBuild​(ExprList args)
      Partially checks if the iterator function can be executed with the given arguments.
      void exec​(java.util.List<NodeValue> args, java.util.function.Consumer<java.util.List<java.util.List<NodeValue>>> listListNodeValue)
      IteratorFunction call to a list of evaluated argument values.
      static org.eclipse.paho.client.mqttv3.MqttConnectOptions getOptions()  
      static void setParser​(java.util.function.Function<byte[],​NodeValue> parser)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OPTIONS

        public static final org.eclipse.paho.client.mqttv3.MqttConnectOptions OPTIONS
      • PARSER

        public static java.util.function.Function<byte[],​NodeValue> PARSER
    • Constructor Detail

      • ITER_MQTTSubscribe

        public ITER_MQTTSubscribe()
    • Method Detail

      • setParser

        public static void setParser​(java.util.function.Function<byte[],​NodeValue> parser)
      • getOptions

        public static org.eclipse.paho.client.mqttv3.MqttConnectOptions getOptions()
      • exec

        public void exec​(java.util.List<NodeValue> args,
                         java.util.function.Consumer<java.util.List<java.util.List<NodeValue>>> listListNodeValue)
        Description copied from class: IteratorStreamFunctionBase
        IteratorFunction call to a list of evaluated argument values.
        Specified by:
        exec in class IteratorStreamFunctionBase
        args - -
        listListNodeValue - - where to emit collections of nodevalues