Example #1
0
 protected override void Dispose(bool explicitDispose)
 {
     _publicationFilter                      = null;
     _processMessageUserDelegate             = null;
     _onSubscriptionActivationUserDelegate   = null;
     _onSubscriptionDeactivationUserDelegate = null;
     //
     base.Dispose(explicitDispose);
 }
Example #2
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;
            }
        }
Example #3
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 #4
0
 public Task <ILocalSubscription> SubscribeAsync <TPayload>(ProcessLocalMessage <TPayload> process, LocalSubscriptionStates subscriptionInitialState = default)
 => InnerPublisher.SubscribeAsync(process: process, state: subscriptionInitialState);
Example #5
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 #6
0
 public virtual Task <ILocalSubscription> SubscribeAsync <TPayload>(ProcessLocalMessage <TPayload> process, LocalPublicationFilter <TPayload> publicationFilter = null)
 => InnerPublisher.SubscribeAsync(publicationFilter: publicationFilter, process: process);
Example #7
0
 public virtual Task <ILocalSubscription> SubscribeAsync <TPayload>(ProcessLocalMessage <TPayload> process)
 => InnerPublisher.SubscribeAsync(process: process);
Example #8
0
 public Task <ILocalSubscription> SubscribeAsync <TData>(ProcessLocalMessage <TData> processMessage, LocalSubscriptionStates state = default(LocalSubscriptionStates))
 => SubscribeAsync(process: processMessage, publicationFilter: null, subscriptionInitialState: state);
Example #9
0
 public Task <ILocalSubscription> SubscribeAsync <TData>(ProcessLocalMessage <TData> processMessage)
 => SubscribeAsync(process: processMessage, publicationFilter: null, subscriptionInitialState: LocalSubscriptionStates.None);
Example #10
0
 public DelegateLocalSubscriber(ProcessLocalMessage <TPayload> processMessage, string aboutInfo = default)
     : this(publicationFilter : null, process : processMessage, aboutInfo : aboutInfo)
 {
 }