Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MqttModule.cs
1using System;
2using System.Threading.Tasks;
3using Waher.Events;
7
8namespace Waher.Things.Mqtt
9{
13 [Singleton]
14 public class MqttModule : IModule
15 {
19 public async Task Start()
20 {
21 try
22 {
23 await this.CheckNode(MeteringTopology.Root);
24 }
25 catch (Exception ex)
26 {
27 Log.Exception(ex);
28 }
29 }
30
31 private async Task CheckNode(INode Node)
32 {
33 foreach (INode Child in await Node.ChildNodes)
34 {
35 if (Child is MqttBrokerNode BrokerNode)
36 await BrokerNode.GetBroker(); // Makes sure it is initialized.
37 else if (Child is IpHost IpHost)
38 await this.CheckNode(IpHost);
39 }
40 }
41
45 public Task Stop()
46 {
47 return Task.CompletedTask;
48 }
49 }
50}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:13
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1647
Node representing an IP Host machine.
Definition: IpHost.cs:21
Defines the Metering Topology data source. This data source contains a tree structure of persistent r...
Node representing a connection to an MQTT broker.
async Task Start()
TODO
Definition: MqttModule.cs:19
Interface for late-bound modules loaded at runtime.
Definition: IModule.cs:9
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.
Definition: INode.cs:140