示例#1
0
 protected virtual void PublicationFilter(LocalPublicationFilterEventArgs <TPayload> e)
 {
     e.EnsureNotNull(nameof(e));
     //
     if (TryReadDA(location: ref _activatedSubscription, considerDisposeRequest: true, result: out var activatedSubscription))
     {
         e.Cancel = !ReferenceEquals(e.Subscription, activatedSubscription);
     }
示例#2
0
        void ILocalPublicationFilterListener.PublicationFilter(object sender, LocalPublicationFilterEventArgs eventArgs)
        {
            eventArgs.EnsureNotNull(nameof(eventArgs));
            //
            var msg = eventArgs.Message as ILocalMessage <TPayload>;

            if (msg is null)
            {
                eventArgs.Cancel = true;
            }
            else
            {
                var locEventArgs = new LocalPublicationFilterEventArgs <TPayload>(subscription: eventArgs.Subscription, message: msg);
                PublicationFilter(locEventArgs);
                eventArgs.Cancel = locEventArgs.OnceCanceled;
            }
        }