Skip to content

Commit

Permalink
Renamed project and cleaned-up references to MQTT broker.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnstee committed Apr 13, 2022
1 parent 1ef83d3 commit 8af9d11
Show file tree
Hide file tree
Showing 61 changed files with 155 additions and 156 deletions.
4 changes: 2 additions & 2 deletions AzureFileStorage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
Expand All @@ -8,7 +8,7 @@ namespace UA.MQTT.Publisher
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using UA.MQTT.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Interfaces;

public class AzureFileStorage : IFileStorage
{
Expand Down
6 changes: 3 additions & 3 deletions CommandProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Opc.Ua;
using Opc.Ua.Cloud.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UA.MQTT.Publisher.Interfaces;
using UA.MQTT.Publisher.Models;

public class CommandProcessor : ICommandProcessor
{
Expand Down
8 changes: 4 additions & 4 deletions Controllers/BrowserController.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

namespace UA.MQTT.Publisher.Controllers
namespace Opc.Ua.Cloud.Publisher.Controllers
{
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Opc.Ua;
using Opc.Ua.Client;
using Opc.Ua.Cloud.Publisher;
using Opc.Ua.Cloud.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Models;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using UA.MQTT.Publisher;
using UA.MQTT.Publisher.Interfaces;
using UA.MQTT.Publisher.Models;

public class BrowserController : Controller
{
Expand Down
4 changes: 2 additions & 2 deletions Controllers/ConfigController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

namespace UA.MQTT.Publisher.Controllers
namespace Opc.Ua.Cloud.Publisher.Controllers
{
using Microsoft.AspNetCore.Mvc;
using UA.MQTT.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Interfaces;

public class ConfigController : Controller
{
Expand Down
2 changes: 1 addition & 1 deletion Controllers/DiagController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Controllers
namespace Opc.Ua.Cloud.Publisher.Controllers
{
using Microsoft.AspNetCore.Mvc;

Expand Down
2 changes: 1 addition & 1 deletion Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Controllers
namespace Opc.Ua.Cloud.Publisher.Controllers
{
using Microsoft.AspNetCore.Mvc;

Expand Down
6 changes: 3 additions & 3 deletions Controllers/PublishedController.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

namespace UA.MQTT.Publisher.Controllers
namespace Opc.Ua.Cloud.Publisher.Controllers
{
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Opc.Ua;
using Opc.Ua.Cloud.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UA.MQTT.Publisher.Interfaces;
using UA.MQTT.Publisher.Models;

public class PublishedController : Controller
{
Expand Down
54 changes: 27 additions & 27 deletions Diagnostics.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
Expand All @@ -8,7 +8,7 @@ namespace UA.MQTT.Publisher
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using UA.MQTT.Publisher.Models;
using Opc.Ua.Cloud.Publisher.Models;

public class Diagnostics
{
Expand Down Expand Up @@ -103,21 +103,21 @@ public async Task RunAsync(CancellationToken cancellationToken = default)
_hubClient.AddOrUpdateTableEntry("OPC UA monitored items queue current items", Info.MonitoredItemsQueueCount.ToString());
_hubClient.AddOrUpdateTableEntry("OPC UA monitored item notifications enqueued", Info.EnqueueCount.ToString());
_hubClient.AddOrUpdateTableEntry("OPC UA monitored item notifications enqueue failure", Info.EnqueueFailureCount.ToString());
_hubClient.AddOrUpdateTableEntry("Messages sent to MQTT broker", Info.SentMessages.ToString());
_hubClient.AddOrUpdateTableEntry("Last successful MQTT broker message sent @", Info.SentLastTime.ToString());
_hubClient.AddOrUpdateTableEntry("Total bytes sent to MQTT broker", Info.SentBytes.ToString());
_hubClient.AddOrUpdateTableEntry("Average MQTT broker message size (bytes)", (Info.SentBytes / (Info.SentMessages == 0 ? 1 : Info.SentMessages)).ToString());
_hubClient.AddOrUpdateTableEntry("Average MQTT broker message latency (ms)", Info.AverageMessageLatency.ToString(), true);
_hubClient.AddOrUpdateTableEntry("Average MQTT broker messages/second sent", messagesPerSecond.ToString(), true);
_hubClient.AddOrUpdateTableEntry("Average number of notifications batched in MQTT broker message", Info.AverageNotificationsInBrokerMessage.ToString());
_hubClient.AddOrUpdateTableEntry("Messages sent to broker", Info.SentMessages.ToString());
_hubClient.AddOrUpdateTableEntry("Last successful broker message sent @", Info.SentLastTime.ToString());
_hubClient.AddOrUpdateTableEntry("Total bytes sent to broker", Info.SentBytes.ToString());
_hubClient.AddOrUpdateTableEntry("Average broker message size (bytes)", (Info.SentBytes / (Info.SentMessages == 0 ? 1 : Info.SentMessages)).ToString());
_hubClient.AddOrUpdateTableEntry("Average broker message latency (ms)", Info.AverageMessageLatency.ToString(), true);
_hubClient.AddOrUpdateTableEntry("Average broker messages/second sent", messagesPerSecond.ToString(), true);
_hubClient.AddOrUpdateTableEntry("Average number of notifications batched in broker message", Info.AverageNotificationsInBrokerMessage.ToString());
_hubClient.AddOrUpdateTableEntry("Average number of OPC UA notifications/second sent", (messagesPerSecond * Info.AverageNotificationsInBrokerMessage).ToString(), true);
_hubClient.AddOrUpdateTableEntry("MQTT broker message send failures", Info.FailedMessages.ToString());
_hubClient.AddOrUpdateTableEntry("MQTT broker messages too large to send to MQTT broker", Info.TooLargeCount.ToString());
_hubClient.AddOrUpdateTableEntry("Missed MQTT broker message send intervals", Info.MissedSendIntervalCount.ToString());
_hubClient.AddOrUpdateTableEntry("broker message send failures", Info.FailedMessages.ToString());
_hubClient.AddOrUpdateTableEntry("broker messages too large to send to broker", Info.TooLargeCount.ToString());
_hubClient.AddOrUpdateTableEntry("Missed broker message send intervals", Info.MissedSendIntervalCount.ToString());
_hubClient.AddOrUpdateTableEntry("Number of OPC UA notifications encoded", Info.NumberOfEvents.ToString());
_hubClient.AddOrUpdateTableEntry("Current working set in MB", (Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024)).ToString());
_hubClient.AddOrUpdateTableEntry("MQTT broker send interval setting (s)", Settings.Instance.DefaultSendIntervalSeconds.ToString());
_hubClient.AddOrUpdateTableEntry("MQTT broker message size setting (bytes)", Settings.Instance.BrokerMessageSize.ToString());
_hubClient.AddOrUpdateTableEntry("broker send interval setting (s)", Settings.Instance.DefaultSendIntervalSeconds.ToString());
_hubClient.AddOrUpdateTableEntry("broker message size setting (bytes)", Settings.Instance.BrokerMessageSize.ToString());

chartValues.Add(Info.AverageMessageLatency.ToString());
chartValues.Add(messagesPerSecond.ToString());
Expand All @@ -127,29 +127,29 @@ public async Task RunAsync(CancellationToken cancellationToken = default)
// write to the log at 10x slower than the UI diagnostics
if (ticks % 10 == 0)
{
_logger.LogInformation($"UA-MQTT-Publisher started @ {Info.PublisherStartTime}");
_logger.LogInformation($"UACloudPublisher started @ {Info.PublisherStartTime}");
_logger.LogInformation($"OPC UA sessions: {Info.NumberOfOpcSessionsConnected}");
_logger.LogInformation($"OPC UA subscriptions: {Info.NumberOfOpcSubscriptionsConnected}");
_logger.LogInformation($"OPC UA monitored items: {Info.NumberOfOpcMonitoredItemsMonitored}");
_logger.LogInformation($"OPC UA monitored items queue capacity: {Settings.Instance.InternalQueueCapacity}");
_logger.LogInformation($"OPC UA monitored items queue current items: {Info.MonitoredItemsQueueCount}");
_logger.LogInformation($"OPC UA monitored item notifications enqueued: {Info.EnqueueCount}");
_logger.LogInformation($"OPC UA monitored item notifications enqueue failure: {Info.EnqueueFailureCount}");
_logger.LogInformation($"Messages sent to MQTT broker: {Info.SentMessages}");
_logger.LogInformation($"Last successful MQTT broker message sent @: {Info.SentLastTime}");
_logger.LogInformation($"Total bytes sent to MQTT broker: {Info.SentBytes}");
_logger.LogInformation($"Average MQTT broker message size (bytes): {Info.SentBytes / (Info.SentMessages == 0 ? 1 : Info.SentMessages)}");
_logger.LogInformation($"Average MQTT broker message latency (ms): {Info.AverageMessageLatency}");
_logger.LogInformation($"Average MQTT broker messages/second sent: {messagesPerSecond}");
_logger.LogInformation($"Average number of notifications batched in MQTT broker message: {Info.AverageNotificationsInBrokerMessage}");
_logger.LogInformation($"Messages sent to broker: {Info.SentMessages}");
_logger.LogInformation($"Last successful broker message sent @: {Info.SentLastTime}");
_logger.LogInformation($"Total bytes sent to broker: {Info.SentBytes}");
_logger.LogInformation($"Average broker message size (bytes): {Info.SentBytes / (Info.SentMessages == 0 ? 1 : Info.SentMessages)}");
_logger.LogInformation($"Average broker message latency (ms): {Info.AverageMessageLatency}");
_logger.LogInformation($"Average broker messages/second sent: {messagesPerSecond}");
_logger.LogInformation($"Average number of notifications batched in broker message: {Info.AverageNotificationsInBrokerMessage}");
_logger.LogInformation($"Average number of OPC UA notifications/second sent: {messagesPerSecond * Info.AverageNotificationsInBrokerMessage}");
_logger.LogInformation($"MQTT broker message send failures: {Info.FailedMessages}");
_logger.LogInformation($"MQTT broker messages too large to send to MQTT broker: {Info.TooLargeCount}");
_logger.LogInformation($"Missed MQTT broker message send intervals: {Info.MissedSendIntervalCount}");
_logger.LogInformation($"broker message send failures: {Info.FailedMessages}");
_logger.LogInformation($"broker messages too large to send to broker: {Info.TooLargeCount}");
_logger.LogInformation($"Missed broker message send intervals: {Info.MissedSendIntervalCount}");
_logger.LogInformation($"Number of OPC UA notifications encoded: {Info.NumberOfEvents}");
_logger.LogInformation($"Current working set in MB: {Process.GetCurrentProcess().WorkingSet64 / (1024 * 1024)}");
_logger.LogInformation($"MQTT broker send interval setting (s): {Settings.Instance.DefaultSendIntervalSeconds}");
_logger.LogInformation($"MQTT broker message size setting (bytes): {Settings.Instance.BrokerMessageSize}");
_logger.LogInformation($"broker send interval setting (s): {Settings.Instance.DefaultSendIntervalSeconds}");
_logger.LogInformation($"broker message size setting (bytes): {Settings.Instance.BrokerMessageSize}");
}

_lastNumMessagesSent = Info.SentMessages;
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["UA-MQTT-Publisher.csproj", "."]
RUN dotnet restore "./UA-MQTT-Publisher.csproj"
COPY ["UACloudPublisher.csproj", "."]
RUN dotnet restore "./UACloudPublisher.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "UA-MQTT-Publisher.csproj" -c Release -o /app/build
RUN dotnet build "UACloudPublisher.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "UA-MQTT-Publisher.csproj" -c Release -o /app/publish
RUN dotnet publish "UACloudPublisher.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "UA-MQTT-Publisher.dll"]
ENTRYPOINT ["dotnet", "UACloudPublisher.dll"]
2 changes: 1 addition & 1 deletion EventUtils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion FilterUtils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using Opc.Ua;
using Opc.Ua.Client;
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IBrokerClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
public interface IBrokerClient
{
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/ICommandProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
public interface ICommandProcessor
{
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IFileStorage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using System.Threading;
using System.Threading.Tasks;
Expand Down
4 changes: 2 additions & 2 deletions Interfaces/IMessageEncoder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using UA.MQTT.Publisher.Models;
using Opc.Ua.Cloud.Publisher.Models;

public interface IMessageEncoder
{
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IMessageProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using System;
using System.Threading;
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IMessagePublisher.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
public interface IMessagePublisher
{
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IMessageSource.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using Opc.Ua.Client;
using System.Collections.Generic;
Expand Down
4 changes: 1 addition & 3 deletions Interfaces/IPublishedNodesFileHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using System.Security.Cryptography.X509Certificates;

public interface IPublishedNodesFileHandler
{
void ParseFile(byte[] content);
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/IUAApplication.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using Opc.Ua;
using System.Threading;
Expand Down
4 changes: 2 additions & 2 deletions Interfaces/IUAClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace UA.MQTT.Publisher.Interfaces
namespace Opc.Ua.Cloud.Publisher.Interfaces
{
using UA.MQTT.Publisher.Models;
using Opc.Ua.Cloud.Publisher.Models;
using System;
using System.Collections.Generic;
using System.Threading;
Expand Down
10 changes: 5 additions & 5 deletions KafkaClient.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

namespace UA.MQTT.Publisher.Configuration
namespace Opc.Ua.Cloud.Publisher.Configuration
{
using Confluent.Kafka;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Text;
using System.Threading;
using UA.MQTT.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Interfaces;

public class KafkaClient : IBrokerClient
{
Expand Down Expand Up @@ -79,7 +79,7 @@ public void Connect()
}
catch (Exception ex)
{
_logger.LogCritical("Failed to connect to MQTT broker: " + ex.Message);
_logger.LogCritical("Failed to connect to Kafka broker: " + ex.Message);
}
}

Expand Down Expand Up @@ -150,14 +150,14 @@ private void HandleMessage(object state)
_logger.LogError("Unknown command received: " + result.Topic);
}

// send reponse to MQTT broker
// send reponse to Kafka broker
Publish(responsePayload);
}
catch (Exception ex)
{
_logger.LogError(ex, "HandleMessageAsync");

// send error to MQTT broker
// send error to Kafka broker
Publish(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ex.Message)));
}
}
Expand Down
4 changes: 2 additions & 2 deletions LocalFileStorage.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

namespace UA.MQTT.Publisher
namespace Opc.Ua.Cloud.Publisher
{
using Microsoft.Extensions.Logging;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using UA.MQTT.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Interfaces;

public class LocalFileStorage : IFileStorage
{
Expand Down
4 changes: 2 additions & 2 deletions MQTTClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace UA.MQTT.Publisher.Configuration
namespace Opc.Ua.Cloud.Publisher.Configuration
{
using Microsoft.Extensions.Logging;
using MQTTnet;
Expand All @@ -20,7 +20,7 @@ namespace UA.MQTT.Publisher.Configuration
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using UA.MQTT.Publisher.Interfaces;
using Opc.Ua.Cloud.Publisher.Interfaces;

public class MQTTClient : IBrokerClient
{
Expand Down
Loading

0 comments on commit 8af9d11

Please sign in to comment.