File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
External/Opc.Ua.PubSub/Transport Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 4141using System . Security . Authentication ;
4242using System . Security . Cryptography . X509Certificates ;
4343using System . Threading . Tasks ;
44+ using umatiGateway . Core . Util ;
4445using DataSet = Opc . Ua . PubSub . PublishedData . DataSet ;
4546using JsonDataSetMessage = Opc . Ua . PubSub . Encoding . JsonDataSetMessage ;
4647using JsonNetworkMessage = Opc . Ua . PubSub . Encoding . JsonNetworkMessage ;
@@ -335,17 +336,16 @@ public void StartWorker()
335336 {
336337 foreach ( MqttApplicationMessage message in this . messageQueue . GetConsumingEnumerable ( ) )
337338 {
338- if ( m_publisherMqttClient != null && m_publisherMqttClient . IsConnected )
339+ Utils . LogInfo ( "Messages in Queue" + this . messageQueue . Count ) ;
340+ try
339341 {
340- try
341- {
342- _ = this . m_publisherMqttClient . PublishAsync ( message ) ;
343- }
344- catch ( Exception ex )
345- {
346- Utils . Trace ( ex , "Exception on Sending Mqtt Message" ) ;
347- }
342+ AsyncHelper . RunSync ( ( ) => m_publisherMqttClient ! . PublishAsync ( message ) ) ;
348343 }
344+ catch ( Exception ex )
345+ {
346+ Utils . Trace ( ex , "Exception on Sending Mqtt Message" ) ;
347+ }
348+
349349 }
350350 } ) ;
351351 }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public static class AsyncHelper
1313 {
1414 private static readonly TaskFactory _taskFactory = new
1515 TaskFactory ( CancellationToken . None ,
16- TaskCreationOptions . None ,
16+ TaskCreationOptions . DenyChildAttach ,
1717 TaskContinuationOptions . None ,
1818 TaskScheduler . Default ) ;
1919
You can’t perform that action at this time.
0 commit comments