You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: src/Program.cs
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,8 @@ public async static Task MainAsync(string[] args)
89
89
{"di|diagnosticsinterval=",$"shows publisher diagnostic info at the specified interval in seconds. 0 disables diagnostic output.\nDefault: {DiagnosticsInterval}",(uintu)=>DiagnosticsInterval=u},
90
90
91
91
{"vc|verboseconsole=",$"the output of publisher is shown on the console.\nDefault: {VerboseConsole}",(boolb)=>VerboseConsole=b},
92
+
93
+
{"ns|noshutdown=",$"publisher could not be stopped by pressing a key on the console, but will run forever.\nDefault: {_noShutdown}",(boolb)=>_noShutdown=b},
92
94
93
95
// IoTHub specific options
94
96
{"ih|iothubprotocol=",$"the protocol to use for communication with Azure IoTHub (allowed values: {string.Join(", ",Enum.GetNames(IotHubProtocol.GetType()))}).\nDefault: {Enum.GetName(IotHubProtocol.GetType(),IotHubProtocol)}",
@@ -432,11 +434,29 @@ public async static Task MainAsync(string[] args)
432
434
// stop on user request
433
435
WriteLine("");
434
436
WriteLine("");
435
-
WriteLine("Publisher is running. Press ENTER to quit.");
437
+
if(_noShutdown)
438
+
{
439
+
// wait forever if asked to do so
440
+
WriteLine("Publisher is running infinite...");
441
+
awaitTask.Delay(Timeout.Infinite);
442
+
}
443
+
else
444
+
{
445
+
WriteLine("Publisher is running. Press any key to quit.");
446
+
try
447
+
{
448
+
ReadKey(true);
449
+
}
450
+
catch
451
+
{
452
+
// wait forever if there is no console
453
+
WriteLine("There is no console. Publisher is running infinite...");
454
+
awaitTask.Delay(Timeout.Infinite);
455
+
}
456
+
}
436
457
WriteLine("");
437
458
WriteLine("");
438
-
ReadLine();
439
-
ShutdownTokenSource.Cancel();
459
+
ShutdownTokenSource.Cancel();
440
460
WriteLine("Publisher is shutting down...");
441
461
442
462
// Wait for session connector completion
@@ -507,7 +527,11 @@ public static async Task SessionConnectorAsync(CancellationToken ct)
507
527
{
508
528
Trace(e,$"Failed to connect and monitor a disconnected server. {(e.InnerException!=null?e.InnerException.Message:"")}");
// give user a warning that the syntax is obsolete
171
-
Trace($"Please update the syntax of the configuration file and use ExpandedNodeId instead of NodeId property name for node with identifier '{publisherConfigFileEntry.NodeId.ToString()}' on EndpointUrl '{publisherConfigFileEntry.EndpointUri.AbsoluteUri}'.");
170
+
else
171
+
{
172
+
// NodeId (ns=) format node configuration syntax using default sampling and publishing interval.
// give user a warning that the syntax is obsolete
175
+
Trace($"Please update the syntax of the configuration file and use ExpandedNodeId instead of NodeId property name for node with identifier '{publisherConfigFileEntry.NodeId.ToString()}' on EndpointUrl '{publisherConfigFileEntry.EndpointUri.AbsoluteUri}'.");
172
176
177
+
}
173
178
}
174
179
}
180
+
else
181
+
{
182
+
Trace($"The node configuration file '{_publisherNodeConfigurationFilename}' does not exist. Starting up and wait for remote configuration requests.");
0 commit comments