public SubscriberRegistry UnregisterSubscriber(IActorRef subscriber) { if (AggregateRegistry.TryGetAggregateId(subscriber, out var aggregateId)) { return(new SubscriberRegistry(AggregateRegistry.Remove(subscriber, aggregateId), DefaultRegistry.Remove(subscriber))); } else { return(new SubscriberRegistry(AggregateRegistry, DefaultRegistry.Remove(subscriber))); } }
public SubscriberRegistry RegisterAggregateSubscriber(IActorRef subscriber, string aggregateId) => new SubscriberRegistry(AggregateRegistry.Add(subscriber, aggregateId), DefaultRegistry);
public SubscriberRegistry(AggregateRegistry aggregateRegistry = null, ImmutableHashSet <IActorRef> defaultRegistry = null) { AggregateRegistry = aggregateRegistry ?? new AggregateRegistry(); DefaultRegistry = defaultRegistry ?? ImmutableHashSet <IActorRef> .Empty; }