diff --git a/Squidex.sln b/Squidex.sln index 574746110..606cec592 100644 --- a/Squidex.sln +++ b/Squidex.sln @@ -32,10 +32,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squidex.Read.Tests", "tests EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squidex.Infrastructure.Redis", "src\Squidex.Infrastructure.Redis\Squidex.Infrastructure.Redis.csproj", "{D7166C56-178A-4457-B56A-C615C7450DEE}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{1667F3B4-31E6-45B2-90FB-97B1ECFE9874}" -EndProject -Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "GenerateLanguages", "tools\GenerateLanguages\GenerateLanguages.csproj", "{927E1F1C-95F0-4991-B33F-603977204B02}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squidex.Infrastructure.RabbitMq", "src\Squidex.Infrastructure.RabbitMq\Squidex.Infrastructure.RabbitMq.csproj", "{C1E5BBB6-6B6A-4DE5-B19D-0538304DE343}" EndProject Global @@ -152,18 +148,6 @@ Global {D7166C56-178A-4457-B56A-C615C7450DEE}.Release|Any CPU.Build.0 = Release|Any CPU {D7166C56-178A-4457-B56A-C615C7450DEE}.Release|x64.ActiveCfg = Release|Any CPU {D7166C56-178A-4457-B56A-C615C7450DEE}.Release|x86.ActiveCfg = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|Any CPU.Build.0 = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|x64.ActiveCfg = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|x64.Build.0 = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|x86.ActiveCfg = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Debug|x86.Build.0 = Debug|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|Any CPU.ActiveCfg = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|Any CPU.Build.0 = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|x64.ActiveCfg = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|x64.Build.0 = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|x86.ActiveCfg = Release|Any CPU - {927E1F1C-95F0-4991-B33F-603977204B02}.Release|x86.Build.0 = Release|Any CPU {C1E5BBB6-6B6A-4DE5-B19D-0538304DE343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C1E5BBB6-6B6A-4DE5-B19D-0538304DE343}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1E5BBB6-6B6A-4DE5-B19D-0538304DE343}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -193,7 +177,6 @@ Global {6A811927-3C37-430A-90F4-503E37123956} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} {8B074219-F69A-4E41-83C6-12EE1E647779} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A} {D7166C56-178A-4457-B56A-C615C7450DEE} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} - {927E1F1C-95F0-4991-B33F-603977204B02} = {1667F3B4-31E6-45B2-90FB-97B1ECFE9874} {C1E5BBB6-6B6A-4DE5-B19D-0538304DE343} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} EndGlobalSection EndGlobal diff --git a/src/Squidex.Infrastructure.RabbitMq/RabbitMqEventConsumer.cs b/src/Squidex.Infrastructure.RabbitMq/RabbitMqEventConsumer.cs index c873ada4d..efafc4645 100644 --- a/src/Squidex.Infrastructure.RabbitMq/RabbitMqEventConsumer.cs +++ b/src/Squidex.Infrastructure.RabbitMq/RabbitMqEventConsumer.cs @@ -20,6 +20,7 @@ namespace Squidex.Infrastructure.RabbitMq { public sealed class RabbitMqEventConsumer : DisposableObjectBase, IExternalSystem, IEventConsumer { + private readonly JsonSerializerSettings serializerSettings; private readonly string exchange; private readonly string streamFilter; private readonly ConnectionFactory connectionFactory; @@ -36,10 +37,11 @@ namespace Squidex.Infrastructure.RabbitMq get { return streamFilter; } } - public RabbitMqEventConsumer(string uri, string exchange, string streamFilter) + public RabbitMqEventConsumer(JsonSerializerSettings serializerSettings, string uri, string exchange, string streamFilter) { Guard.NotNullOrEmpty(uri, nameof(uri)); Guard.NotNullOrEmpty(exchange, nameof(exchange)); + Guard.NotNull(serializerSettings, nameof(serializerSettings)); connectionFactory = new ConnectionFactory { Uri = uri }; @@ -49,6 +51,7 @@ namespace Squidex.Infrastructure.RabbitMq this.exchange = exchange; this.streamFilter = streamFilter; + this.serializerSettings = serializerSettings; } protected override void DisposeObject(bool disposing) @@ -84,7 +87,7 @@ namespace Squidex.Infrastructure.RabbitMq public Task On(Envelope @event) { - var jsonString = JsonConvert.SerializeObject(@event); + var jsonString = JsonConvert.SerializeObject(@event, serializerSettings); var jsonBytes = Encoding.UTF8.GetBytes(jsonString); channel.Value.BasicPublish(exchange, string.Empty, null, jsonBytes); diff --git a/src/Squidex.Infrastructure.RabbitMq/RabbitMqOptions.cs b/src/Squidex.Infrastructure.RabbitMq/RabbitMqOptions.cs deleted file mode 100644 index 39dc6820c..000000000 --- a/src/Squidex.Infrastructure.RabbitMq/RabbitMqOptions.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Squidex.Infrastructure.RabbitMq -{ - class RabbitMqOptions - { - } -} diff --git a/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj b/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj index 1882daafa..ab2f8af4c 100644 --- a/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj +++ b/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj @@ -10,6 +10,6 @@ - + \ No newline at end of file diff --git a/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs b/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs index 1d056c8a9..8ee8698e0 100644 --- a/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs +++ b/src/Squidex.Infrastructure/CQRS/Events/EventReceiver.cs @@ -7,7 +7,6 @@ // ========================================================================== using System; -using System.Reactive.Linq; using System.Threading.Tasks; using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Timers; diff --git a/src/Squidex/Config/Domain/RabbitMqModule.cs b/src/Squidex/Config/Domain/RabbitMqModule.cs index ce0a9944d..f05c20124 100644 --- a/src/Squidex/Config/Domain/RabbitMqModule.cs +++ b/src/Squidex/Config/Domain/RabbitMqModule.cs @@ -8,6 +8,7 @@ using Autofac; using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; using Squidex.Infrastructure; using Squidex.Infrastructure.CQRS.Events; using Squidex.Infrastructure.RabbitMq; @@ -37,7 +38,7 @@ namespace Squidex.Config.Domain { var streamFilter = Configuration.GetValue("squidex:eventPublishers:rabbitMq:streamFilter"); - builder.Register(c => new RabbitMqEventConsumer(connectionString, exchange, streamFilter)) + builder.Register(c => new RabbitMqEventConsumer(c.Resolve(), connectionString, exchange, streamFilter)) .As() .As() .SingleInstance(); diff --git a/src/Squidex/Squidex.csproj b/src/Squidex/Squidex.csproj index 3306a9828..06046590b 100644 --- a/src/Squidex/Squidex.csproj +++ b/src/Squidex/Squidex.csproj @@ -23,9 +23,9 @@ + - diff --git a/src/Squidex/appsettings.json b/src/Squidex/appsettings.json index 08a5cd51e..4a7c4d1aa 100644 --- a/src/Squidex/appsettings.json +++ b/src/Squidex/appsettings.json @@ -22,7 +22,7 @@ "eventPublishers": { "rabbitMq": { "connectionString": "amqp://guest:guest@localhost/", - "exchange": "Squidex", + "exchange": "squidex", "enabled": false, "streamFilter": "*" } diff --git a/tests/Squidex.Infrastructure.Tests/Log/SemanticLogTests.cs b/tests/Squidex.Infrastructure.Tests/Log/SemanticLogTests.cs index ac82728e1..6c6d0e42e 100644 --- a/tests/Squidex.Infrastructure.Tests/Log/SemanticLogTests.cs +++ b/tests/Squidex.Infrastructure.Tests/Log/SemanticLogTests.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; -using System.Reflection; using Microsoft.Extensions.Logging; using Moq; using Squidex.Infrastructure.Log.Adapter;