diff --git a/Docs/Modeli komunikacije – Faza 3.docx b/Docs/Modeli komunikacije – Faza 3.docx
new file mode 100644
index 0000000..e3edb94
Binary files /dev/null and b/Docs/Modeli komunikacije – Faza 3.docx differ
diff --git a/Docs/Modeli komunikacije – Faza 3.pdf b/Docs/Modeli komunikacije – Faza 3.pdf
new file mode 100644
index 0000000..98e146a
Binary files /dev/null and b/Docs/Modeli komunikacije – Faza 3.pdf differ
diff --git a/Docs/dijagrami/communcation_components b/Docs/dijagrami/communcation_components
new file mode 100644
index 0000000..e969740
--- /dev/null
+++ b/Docs/dijagrami/communcation_components
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Docs/dijagrami/communication_components.png b/Docs/dijagrami/communication_components.png
new file mode 100644
index 0000000..fee50fe
Binary files /dev/null and b/Docs/dijagrami/communication_components.png differ
diff --git a/Docs/dijagrami/implementacija.drawio b/Docs/dijagrami/implementacija.drawio
new file mode 100644
index 0000000..890c2b1
--- /dev/null
+++ b/Docs/dijagrami/implementacija.drawio
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Docs/dijagrami/implementacija.png b/Docs/dijagrami/implementacija.png
new file mode 100644
index 0000000..4c506ff
Binary files /dev/null and b/Docs/dijagrami/implementacija.png differ
diff --git a/dotnet/AipsCore/Application/Abstract/MessageBroking/IMessageTypesProvider.cs b/dotnet/AipsCore/Application/Abstract/MessageBroking/IMessageTypesProvider.cs
new file mode 100644
index 0000000..484834e
--- /dev/null
+++ b/dotnet/AipsCore/Application/Abstract/MessageBroking/IMessageTypesProvider.cs
@@ -0,0 +1,6 @@
+namespace AipsCore.Application.Abstract.MessageBroking;
+
+public interface IMessageTypesProvider
+{
+ ICollection GetAllMessageTypes();
+}
\ No newline at end of file
diff --git a/dotnet/AipsCore/Application/Abstract/MessageBroking/MessageTag.cs b/dotnet/AipsCore/Application/Abstract/MessageBroking/MessageTag.cs
deleted file mode 100644
index a5b002b..0000000
--- a/dotnet/AipsCore/Application/Abstract/MessageBroking/MessageTag.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace AipsCore.Application.Abstract.MessageBroking;
-
-public enum MessageTag
-{
- Worker,
- RT
-}
\ No newline at end of file
diff --git a/dotnet/AipsWorker/Messages/MessageTypesProvider.cs b/dotnet/AipsWorker/Messages/MessageTypesProvider.cs
new file mode 100644
index 0000000..3c6b538
--- /dev/null
+++ b/dotnet/AipsWorker/Messages/MessageTypesProvider.cs
@@ -0,0 +1,23 @@
+using AipsCore.Application.Abstract.MessageBroking;
+using AipsCore.Application.Common.Message.AddArrow;
+using AipsCore.Application.Common.Message.AddLine;
+using AipsCore.Application.Common.Message.AddRectangle;
+using AipsCore.Application.Common.Message.AddTextShape;
+using AipsCore.Application.Common.Message.MoveShape;
+
+namespace AipsWorker.Messages;
+
+public class MessageTypesProvider : IMessageTypesProvider
+{
+ public ICollection GetAllMessageTypes()
+ {
+ return
+ [
+ typeof(AddArrowMessage),
+ typeof(AddLineMessage),
+ typeof(AddRectangleMessage),
+ typeof(AddTextShapeMessage),
+ typeof(MoveShapeMessage)
+ ];
+ }
+}
\ No newline at end of file
diff --git a/dotnet/AipsWorker/Program.cs b/dotnet/AipsWorker/Program.cs
index b9187cb..899183f 100644
--- a/dotnet/AipsWorker/Program.cs
+++ b/dotnet/AipsWorker/Program.cs
@@ -1,5 +1,7 @@
-using AipsCore.Infrastructure.DI;
+using AipsCore.Application.Abstract.MessageBroking;
+using AipsCore.Infrastructure.DI;
using AipsWorker;
+using AipsWorker.Messages;
using AipsWorker.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -13,6 +15,8 @@ builder.ConfigureServices((context, services) =>
services.AddAips(context.Configuration);
services.AddAipsMessageHandlers();
+ services.AddSingleton();
+
services.AddHostedService();
});
diff --git a/dotnet/AipsWorker/WorkerService.cs b/dotnet/AipsWorker/WorkerService.cs
index 48060c5..5f6d8a8 100644
--- a/dotnet/AipsWorker/WorkerService.cs
+++ b/dotnet/AipsWorker/WorkerService.cs
@@ -11,11 +11,13 @@ namespace AipsWorker;
public class WorkerService : BackgroundService
{
private readonly IDispatcher _dispatcher;
+ private readonly IMessageTypesProvider _messageTypesProvider;
private readonly SubscribeMethodUtility _subscribeMethodUtility;
- public WorkerService(IMessageSubscriber subscriber, IDispatcher dispatcher)
+ public WorkerService(IMessageSubscriber subscriber, IDispatcher dispatcher, IMessageTypesProvider messageTypesProvider)
{
_dispatcher = dispatcher;
+ _messageTypesProvider = messageTypesProvider;
_subscribeMethodUtility = new SubscribeMethodUtility(subscriber);
}
@@ -23,7 +25,7 @@ public class WorkerService : BackgroundService
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
- var messageTypes = GetAllMessageTypes();
+ var messageTypes = _messageTypesProvider.GetAllMessageTypes();
foreach (var messageType in messageTypes)
{
@@ -33,20 +35,6 @@ public class WorkerService : BackgroundService
}
}
- private IReadOnlyCollection GetAllMessageTypes()
- {
- var messageInterface = typeof(IMessage);
- var assembly = messageInterface.Assembly;
-
- return assembly
- .GetTypes()
- .Where(t =>
- !t.IsAbstract &&
- !t.IsInterface &&
- messageInterface.IsAssignableFrom(t))
- .ToList();
- }
-
private async Task HandleMessage(T message, CancellationToken ct) where T : IMessage
{
try