diff --git a/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs b/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs index 5eaea4ba..5eda3b64 100644 --- a/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs +++ b/Shared.EventStore/Extensions/IApplicationBuilderExtenstions.cs @@ -115,12 +115,8 @@ private static SubscriptionWorker ConfigureSubscriptionWorker(ISubscriptionRepos _ => SubscriptionWorker.CreateSubscriptionWorker(eventStoreConnectionString, ehr.Value, subscriptionRepository, configurationSubscriptionWorker.InflightMessages, configuration.PersistentSubscriptionPollingInSeconds), }; - worker.Trace += (_, - args) => traceHandler(TraceEventType.Information, type, args.Message); - worker.Warning += (_, - args) => traceHandler(TraceEventType.Warning, type, args.Message); - worker.Error += (_, - args) => traceHandler(TraceEventType.Error, type, args.Message); + worker.ConfigureTracing(type, traceHandler); + worker.SetIgnoreGroups(configurationSubscriptionWorker.IgnoreGroups); worker.SetIgnoreStreams(configurationSubscriptionWorker.IgnoreStreams); worker.SetIncludeGroups(configurationSubscriptionWorker.IncludeGroups); @@ -128,5 +124,8 @@ private static SubscriptionWorker ConfigureSubscriptionWorker(ISubscriptionRepos return worker; } + + #endregion + } \ No newline at end of file diff --git a/Shared.EventStore/SubscriptionWorker/SubscriptionWorkerHelper.cs b/Shared.EventStore/SubscriptionWorker/SubscriptionWorkerHelper.cs index ddec82a3..7c3a483a 100644 --- a/Shared.EventStore/SubscriptionWorker/SubscriptionWorkerHelper.cs +++ b/Shared.EventStore/SubscriptionWorker/SubscriptionWorkerHelper.cs @@ -4,6 +4,7 @@ using global::EventStore.Client; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net.Http; @@ -171,5 +172,12 @@ public static SubscriptionWorker UseInMemory(this SubscriptionWorker subscriptio return subscriptionWorker; } + public static void ConfigureTracing(this SubscriptionWorker worker, string type, Action traceHandler) + { + worker.Trace += (_, args) => traceHandler(TraceEventType.Information, type, args.Message); + worker.Warning += (_, args) => traceHandler(TraceEventType.Warning, type, args.Message); + worker.Error += (_, args) => traceHandler(TraceEventType.Error, type, args.Message); + } + #endregion } \ No newline at end of file