예제 #1
0
 public ResubscribeCacheElement(TFilterCriteria criteria, ReactiveActions <TActionArg> actions,
                                IDisposable providerSubscription)
 {
     ProviderSubscription = providerSubscription;
     Criteria             = criteria;
     Actions = actions;
 }
예제 #2
0
 public ResubscribeCacheElement(TFilterCriteria criteria, ReactiveActions <TActionArg> actions)
 {
     ProviderSubscription = null;
     Criteria             = criteria;
     Actions       = actions;
     CurrentStatus = LiveSubscriptionStatus.Rotten;
 }
예제 #3
0
        public async Task <IDisposable> Subscribe(TCriteria criteria,
                                                  ReactiveActions <TActionArgument> actions)
        {
            var cacheElement = new ResubscribeCacheElement <TCriteria, TActionArgument>(criteria, actions);

            cache.Add(cacheElement);

            await TrySubscribeOnCacheElement(cacheElement).ConfigureAwait(false);

            return(cacheElement);
        }
        private ReactiveActions BuildTestAsset()
        {
            var r = new ReactiveActions();

            var d = new ActionTendency((Name)"Speak([speachType])", (Name)"[x]");

            d.ActivationCooldown = 2;
            r.AddActionTendency(d);

            d = new ActionTendency((Name)"Speak(formal)", (Name)"[x]");
            d.ActivationCooldown = 5;
            r.AddActionTendency(d);
            return(r);
        }
예제 #5
0
        public async Task <SubscriptionId> Subscribe(TCriteria criteria, ReactiveActions <TNextArgument> actions)
        {
            var idTask = SafeWait(async() =>
            {
                if (subscriptions.ContainsKey(criteria))
                {
                    subscriptions[criteria].IncreaseCounter();
                    return(subscriptions[criteria].SubscriptionId);
                }

                var disposable          = await SubscribeInternal(criteria, actions).ConfigureAwait(false);
                var generatedId         = generator.GetNewId();
                var virtualSubscription = new VirtualSubscription(generatedId, disposable);
                subscriptions.Add(criteria, virtualSubscription);
                return(generatedId);
            });

            var subscriptionId = await idTask.ConfigureAwait(false);

            return(subscriptionId);
        }
예제 #6
0
 public Task <IDisposable> Subscribe(TCriteria criteria, ReactiveActions <TNextArg> actions)
 {
     return(Subscribe(criteria, actions.NextAction, actions.ErrorAction));
 }
예제 #7
0
 public SingleSubscriberInfo(ReactiveActions <TNextArg> actions)
 {
     Actions = actions;
 }
 public Task <SubscriptionId> Subscribe(TCriteria criteria,
                                        ReactiveActions <TActionArg> actions)
 {
     return(Subscribe(criteria, actions.NextAction, actions.ErrorAction));
 }