Example #1
0
 protected override void Dispose(bool explicitDispose)
 {
     _publicationFilter                      = null;
     _processMessageUserDelegate             = null;
     _onSubscriptionActivationUserDelegate   = null;
     _onSubscriptionDeactivationUserDelegate = null;
     //
     base.Dispose(explicitDispose);
 }
Example #2
0
 public DelegateLocalSubscriber(
     ProcessLocalMessage <TPayload> process,
     LocalPublicationFilter <TPayload> publicationFilter             = default,
     LocalSubscriptionActivationHandler onSubscriptionActivation     = default,
     LocalSubscriptionDeactivationHandler onSubscriptionDeactivation = default,
     string aboutInfo = default)
     : base(aboutInfo : aboutInfo)
 {
     //
     process.EnsureNotNull(nameof(process));
     //
     _processMessageUserDelegate             = process;
     _publicationFilter                      = publicationFilter;
     _onSubscriptionActivationUserDelegate   = onSubscriptionActivation;
     _onSubscriptionDeactivationUserDelegate = onSubscriptionDeactivation;
 }
Example #3
0
 public virtual Task <ILocalSubscription> SubscribeAsync <TPayload>(ProcessLocalMessage <TPayload> process, LocalPublicationFilter <TPayload> publicationFilter = default, LocalSubscriptionStates subscriptionInitialState = default)
 => InnerPublisher.SubscribeAsync(publicationFilter: publicationFilter, process: process, subscriptionInitialState: subscriptionInitialState);
Example #4
0
 public virtual Task <ILocalSubscription> SubscribeAsync <TPayload>(ProcessLocalMessage <TPayload> process, LocalPublicationFilter <TPayload> publicationFilter = null)
 => InnerPublisher.SubscribeAsync(publicationFilter: publicationFilter, process: process);
Example #5
0
 public Task <ILocalSubscription> SubscribeAsync <TData>(ProcessLocalMessage <TData> processMessage, LocalPublicationFilter <TData> publicationFilter)
 => SubscribeAsync(process: processMessage, publicationFilter: publicationFilter, subscriptionInitialState: LocalSubscriptionStates.None);
Example #6
0
        public virtual async Task <ILocalSubscription> SubscribeAsync <TData>(ProcessLocalMessage <TData> process, LocalPublicationFilter <TData> publicationFilter = null, LocalSubscriptionStates subscriptionInitialState = default)
        {
            var subscription = default(ILocalSubscription);
            var subscriber   = default(ILocalSubscriber);

            try {
                subscriber   = new DelegateLocalSubscriber <TData>(process: process, publicationFilter: publicationFilter);
                subscription = new LocalSubscription(publisher: this, subscriber: subscriber, initialState: LocalSubscriptionStates.OwnsSubscriber | LocalSubscriptionStates.PublisherOwnsSubscription | subscriptionInitialState);
                return(await SubscribeAsync(subscription : subscription).ConfigureAwait(false));
            }
            catch (Exception exception) {
                DisposeMany(exception, subscriber, subscription);
                throw;
            }
        }