Esempio n. 1
0
 /// <summary>
 /// Inititalizes a new instance of the <see cref="MqttListener"/> class.
 /// </summary>
 /// <param name="connection">The connection to listen on.</param>
 /// <param name="topics">The topics to subscribe to.</param>
 /// <param name="executor">Allows the function to be executed.</param>
 /// <param name="logger">The logger.</param>
 public MqttListener(IMqttConnection connection, TopicFilter[] topics, ITriggeredFunctionExecutor executor, ILogger logger)
 {
     _executor                = executor;
     _logger                  = logger;
     _mqttConnection          = connection;
     _topics                  = topics;
     _cancellationTokenSource = new CancellationTokenSource();
 }
Esempio n. 2
0
        private MqttCacheTopic(IMqttConnection connection, MqttCacheTopic parent, string level)
        {
            _connection = connection;

            Level  = level;
            Parent = parent;
            Topic  = parent.Topic == null            //i.e. Root
                                ? level
                                : parent.Topic + "/" + level;

            var engine = Run().Replay(1, Scheduler.Immediate);

            _subscription = engine.Connect();
            _status       = engine;
        }
Esempio n. 3
0
        private int _pendingInitializers;         // even if we should have only one concurrent initializer, be safer

        public MqttCache(IMqttConnection connection)
        {
            Root = new MqttCacheTopic(connection);
        }
Esempio n. 4
0
 /// <summary>
 /// Creates a root topic
 /// </summary>
 public MqttCacheTopic(IMqttConnection connection)
 {
     _connection = connection;
 }