Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ClientProxyBase/ClientProxyBase_PUT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected virtual async Task<Result> SendHttpPutRequest<TRequest>(String uri,
requestMessage.Content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
}

// Make the Http Call here;
// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.SendAsync(requestMessage, cancellationToken);

// Process the response
Expand Down
21 changes: 15 additions & 6 deletions Shared.EventStore/SubscriptionWorker/PersistentSubscription.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System.Runtime.CompilerServices;
using KurrentDB.Client;
using KurrentDB.Client;
using SimpleResults;

namespace Shared.EventStore.SubscriptionWorker;

using Aggregate;
using DomainDrivenDesign.EventSourcing;
using EventHandling;
using global::EventStore.Client;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Shared.General;
Expand All @@ -24,7 +22,7 @@
{
public EventHandler<String> SubscriptionHasDropped;

public EventHandler<String> EventHandlerMissing;
public EventHandler<String> EventHandlerIsMissing;

Check warning on line 25 in Shared.EventStore/SubscriptionWorker/PersistentSubscription.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Shared.EventStore/SubscriptionWorker/PersistentSubscription.cs#L25

Make 'EventHandlerIsMissing' private.

Check warning on line 25 in Shared.EventStore/SubscriptionWorker/PersistentSubscription.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Shared.EventStore/SubscriptionWorker/PersistentSubscription.cs#L25

Make this field 'private' and encapsulate it in a 'public' property.

private readonly Func<CancellationToken, Task<KurrentDB.Client.PersistentSubscription>> Subscribe;

Expand All @@ -44,6 +42,18 @@
}
}

public void EventHandlerMissing(String reason)
{
this.Connected = false;
Logger.Logger.LogWarning($"Event handler missing - {reason}");

if (this.EventHandlerIsMissing != null)
{
//Broadcast to owner
this.EventHandlerIsMissing(this, reason);
}
}

private PersistentSubscription(IPersistentSubscriptionsClient persistentSubscriptionsClient,
PersistentSubscriptionDetails persistentSubscriptionDetails,
IDomainEventHandlerResolver domainEventHandlerResolver,
Expand Down Expand Up @@ -144,8 +154,7 @@

if (domainEventHandlersResult.IsFailed) {
// Log a line of trace out
if (this.EventHandlerMissing != null)
this.EventHandlerMissing(this, $"No event handlers configured for Event Type [{domainEvent.GetType().Name}]");
this.EventHandlerMissing($"No event handlers configured for Event Type [{domainEvent.GetType().Name}]");

await PersistentSubscriptionsHelper.AckEvent(persistentSubscription, resolvedEvent);
return;
Expand Down
Loading