public override Task EnqueueDispatch(SignalDispatch <TKey> dispatch,
                                             SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            if (_isStarted == false)
            {
                ThrowStoppedInstanceError();
            }

            return(base.EnqueueDispatch(dispatch, writeConcern));
        }
Exemple #2
0
        public virtual SignalWriteConcern GetWriteConcernOrDefault(SignalWriteConcern writeConcern)
        {
            if (writeConcern != SignalWriteConcern.Default)
            {
                return(writeConcern);
            }

            if (DefaultWriteConcern != SignalWriteConcern.Default)
            {
                return(DefaultWriteConcern);
            }

            return(SignalWriteConcern.MemoryOnly);
        }
Exemple #3
0
        protected virtual async Task EnqueueSignalEvent(SignalEvent <TKey> signalEvent, SignalWriteConcern writeConcern)
        {
            writeConcern = _senderSettings.GetWriteConcernOrDefault(writeConcern);
            bool ensurePersisted = writeConcern == SignalWriteConcern.PersistentStorage;

            if (ensurePersisted)
            {
                await _eventQueries.Insert(new List <SignalEvent <TKey> > {
                    signalEvent
                })
                .ConfigureAwait(false);
            }

            var signalWrapper = new SignalWrapper <SignalEvent <TKey> >(signalEvent, ensurePersisted);

            _eventQueue.Append(signalWrapper);

            _monitor.EventReceived(signalEvent);
        }
Exemple #4
0
        public virtual Task EnqueueDirectAddressesEvent(SignalDataDto signalDataDto,
                                                        List <DeliveryAddress> deliveryAddresses, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            var signalEvent = new SignalEvent <TKey>()
            {
                AddresseeType       = AddresseeType.DirectAddresses,
                PredefinedAddresses = deliveryAddresses,
                CreateDateUtc       = DateTime.UtcNow,
                EventKey            = signalDataDto.EventKey,
                TemplateDataDict    = signalDataDto.TemplateDataDict,
                TemplateDataObj     = signalDataDto.TemplateDataObj,
                MachineName         = signalDataDto.MachineName,
                ApplicationName     = signalDataDto.ApplicationName
            };

            return(EnqueueSignalEvent(signalEvent, writeConcern));
        }
Exemple #5
0
        public virtual Task EnqueueDirectSubscriberIdsEvent(SignalDataDto signalDataDto,
                                                            List <TKey> subscriberIds, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            var signalEvent = new SignalEvent <TKey>()
            {
                AddresseeType           = AddresseeType.SubscriberIds,
                PredefinedSubscriberIds = subscriberIds,
                TopicId          = topicId,
                CreateDateUtc    = DateTime.UtcNow,
                EventKey         = signalDataDto.EventKey,
                TemplateDataDict = signalDataDto.TemplateDataDict,
                TemplateDataObj  = signalDataDto.TemplateDataObj,
                MachineName      = signalDataDto.MachineName,
                ApplicationName  = signalDataDto.ApplicationName
            };

            return(EnqueueSignalEvent(signalEvent, writeConcern));
        }
Exemple #6
0
        //methods
        public virtual Task EnqueueMatchSubscribersEvent(SignalDataDto signalDataDto,
                                                         Dictionary <string, string> subscriberFiltersData = null, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            var signalEvent = new SignalEvent <TKey>()
            {
                AddresseeType         = AddresseeType.SubscriptionParameters,
                SubscriberFiltersData = subscriberFiltersData,
                TopicId          = topicId,
                CreateDateUtc    = DateTime.UtcNow,
                EventKey         = signalDataDto.EventKey,
                TemplateDataDict = signalDataDto.TemplateDataDict,
                TemplateDataObj  = signalDataDto.TemplateDataObj,
                MachineName      = signalDataDto.MachineName,
                ApplicationName  = signalDataDto.ApplicationName
            };

            return(EnqueueSignalEvent(signalEvent, writeConcern));
        }
Exemple #7
0
        public virtual async Task EnqueueDispatch(SignalDispatch <TKey> signalDispatch, SignalWriteConcern writeConcern)
        {
            writeConcern = _senderSettings.GetWriteConcernOrDefault(writeConcern);
            bool ensurePersisted = writeConcern == SignalWriteConcern.PersistentStorage;

            if (ensurePersisted)
            {
                if (_senderSettings.IsDbLockStorageEnabled)
                {
                    signalDispatch.LockedBy       = _senderSettings.LockedByInstanceId;
                    signalDispatch.LockedSinceUtc = DateTime.UtcNow;
                }
                await _dispatchQueries.Insert(new List <SignalDispatch <TKey> > {
                    signalDispatch
                })
                .ConfigureAwait(false);
            }

            var signalWrapper = new SignalWrapper <SignalDispatch <TKey> >(signalDispatch, ensurePersisted);

            _dispatchQueue.Append(signalWrapper);

            _monitor.DispatchTransferred(signalDispatch);
        }
Exemple #8
0
 public Task Dispatch(SignalDispatch <TKey> dispatch, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
 {
     return(base.EnqueueDispatch(dispatch, writeConcern));
 }
Exemple #9
0
 public Task DirectAddressesEvent(SignalDataDC signalDataDto, List <DeliveryAddress> deliveryAddresses, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
 {
     return(base.EnqueueDirectAddressesEvent(signalDataDto, deliveryAddresses, writeConcern));
 }
Exemple #10
0
 public Task DirectSubscriberIdsEvent(SignalDataDC signalDataDto, List <TKey> subscriberIds, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
 {
     return(base.EnqueueDirectSubscriberIdsEvent(signalDataDto, subscriberIds, topicId, writeConcern));
 }
Exemple #11
0
 public Task MatchSubscribersEvent(SignalDataDC signalDataDto, Dictionary <string, string> subscriberFilters = null, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
 {
     return(base.EnqueueMatchSubscribersEvent(signalDataDto, subscriberFilters, topicId, writeConcern));
 }
        public override Task EnqueueDirectAddressesEvent(SignalDataDto signalData,
                                                         List <DeliveryAddress> deliveryAddresses, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            if (_isStarted == false)
            {
                ThrowStoppedInstanceError();
            }

            return(base.EnqueueDirectAddressesEvent(signalData, deliveryAddresses, writeConcern));
        }
        public override Task EnqueueDirectSubscriberIdsEvent(SignalDataDto signalData,
                                                             List <TKey> subscriberIds, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            if (_isStarted == false)
            {
                ThrowStoppedInstanceError();
            }

            return(base.EnqueueDirectSubscriberIdsEvent(signalData, subscriberIds, topicId, writeConcern));
        }
        public override Task EnqueueMatchSubscribersEvent(SignalDataDto signalData,
                                                          Dictionary <string, string> subscriberFiltersData = null, string topicId = null, SignalWriteConcern writeConcern = SignalWriteConcern.Default)
        {
            if (_isStarted == false)
            {
                ThrowStoppedInstanceError();
            }

            return(base.EnqueueMatchSubscribersEvent(signalData, subscriberFiltersData, topicId, writeConcern));
        }