Browse Source

Continue after failed

pull/130/merge
Sebastian Stehle 9 years ago
parent
commit
b7ce4859b7
  1. 18
      src/Squidex.Infrastructure/CQRS/Events/Actors/EventConsumerActor.cs

18
src/Squidex.Infrastructure/CQRS/Events/Actors/EventConsumerActor.cs

@ -31,6 +31,11 @@ namespace Squidex.Infrastructure.CQRS.Events.Actors
public IEventConsumer EventConsumer { get; set; } public IEventConsumer EventConsumer { get; set; }
} }
private sealed class StopFailed
{
public Exception Exception { get; set; }
}
private abstract class SubscriptionMessage private abstract class SubscriptionMessage
{ {
public IEventSubscription Subscription { get; set; } public IEventSubscription Subscription { get; set; }
@ -86,7 +91,9 @@ namespace Squidex.Infrastructure.CQRS.Events.Actors
.WriteProperty("state", "Failed") .WriteProperty("state", "Failed")
.WriteProperty("eventConsumer", eventConsumer.Name)); .WriteProperty("eventConsumer", eventConsumer.Name));
return StopAsync(exception); DispatchAsync(new StopFailed { Exception = exception }).Forget();
return TaskHelper.Done;
} }
Task IEventSubscriber.OnEventAsync(IEventSubscription subscription, StoredEvent @event) Task IEventSubscriber.OnEventAsync(IEventSubscription subscription, StoredEvent @event)
@ -128,6 +135,15 @@ namespace Squidex.Infrastructure.CQRS.Events.Actors
break; break;
} }
case StopFailed stopFailed when isSetup && isRunning:
{
await StopAsync(stopFailed.Exception);
isRunning = false;
break;
}
case StopConsumerMessage stopConsumer when isSetup && isRunning: case StopConsumerMessage stopConsumer when isSetup && isRunning:
{ {
await StopAsync(); await StopAsync();

Loading…
Cancel
Save