public GetTopicConsumeInfoListService(ConsumerManager consumerManager, IConsumeOffsetStore consumeOffsetStore, IQueueStore queueStore, ITpsStatisticService tpsStatisticService)
 {
     _consumerManager = consumerManager;
     _consumeOffsetStore = consumeOffsetStore;
     _queueStore = queueStore;
     _tpsStatisticService = tpsStatisticService;
 }
Ejemplo n.º 2
0
 public ItemStore(IStorageLocator storageLocator)
 {
     _table = storageLocator.GetTable(TABLE_NAME);
     _rawBlob = storageLocator.GetBlob(RAW_BLOB_NAME);
     _finishedBlob = storageLocator.GetBlob(FINISHED_BLOB_NAME);
     _queue = storageLocator.GetQueue(QUEUE_NAME);
 }
 public QueryConsumerInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _queueService = ObjectContainer.Resolve<IQueueStore>();
 }
Ejemplo n.º 4
0
 public SendMessageRequestHandler()
 {
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _queueService = ObjectContainer.Resolve<IQueueStore>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
Ejemplo n.º 5
0
 public PullMessageRequestHandler()
 {
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
Ejemplo n.º 6
0
 public QueueService(IQueueStore queueStore, IMessageStore messageStore, IOffsetManager offsetManager, IScheduleService scheduleService, ILoggerFactory loggerFactory)
 {
     _queueDict = new ConcurrentDictionary<string, Queue>();
     _queueStore = queueStore;
     _messageStore = messageStore;
     _offsetManager = offsetManager;
     _scheduleService = scheduleService;
     _logger = loggerFactory.Create(GetType().FullName);
 }
Ejemplo n.º 7
0
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageStore = ObjectContainer.Resolve<IMessageStore>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _tpsStatisticService = ObjectContainer.Resolve<ITpsStatisticService>();
     _notifyWhenMessageArrived = _brokerController.Setting.NotifyWhenMessageArrived;
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _sendRTLogger = ObjectContainer.Resolve<ILoggerFactory>().Create("SendRT");
     var messageWriteQueueThreshold = brokerController.Setting.MessageWriteQueueThreshold;
     _bufferQueue = new BufferQueue<StoreContext>("QueueBufferQueue", messageWriteQueueThreshold, OnQueueMessageCompleted, _logger);
 }
Ejemplo n.º 8
0
 public SuspendedPullRequestManager()
 {
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _notifyQueue = new BlockingCollection<NotifyItem>(new ConcurrentQueue<NotifyItem>());
     _notifyMessageArrivedWorker = new Worker("NotifyMessageArrived", () =>
     {
         var notifyItem = _notifyQueue.Take();
         if (notifyItem == null) return;
         NotifyMessageArrived(notifyItem.Topic, notifyItem.QueueId, notifyItem.QueueOffset);
     });
 }
Ejemplo n.º 9
0
 public SuspendedPullRequestManager()
 {
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _notifyQueue = new BlockingCollection<NotifyItem>(new ConcurrentQueue<NotifyItem>());
     _taskFactory = new TaskFactory(new LimitedConcurrencyLevelTaskScheduler(Environment.ProcessorCount));
     _checkBlockingPullRequestTaskName = string.Format("{0}.CheckBlockingPullRequest", this.GetType().Name);
     _notifyMessageArrivedWorker = new Worker(string.Format("{0}.NotifyMessageArrived", this.GetType().Name), () =>
     {
         var notifyItem = _notifyQueue.Take();
         if (notifyItem == null) return;
         NotifyMessageArrived(notifyItem.Topic, notifyItem.QueueId, notifyItem.QueueOffset);
     });
 }
Ejemplo n.º 10
0
        public static TaskQueue StartNew(string name, string displayName, TaskQueueOptions options, IQueueStore queueStore)
        {
            var queue = new TaskQueue(name, displayName, options, queueStore);

            if (!_queues.TryAdd(name, queue))
            {
                queue.Dispose();
                throw new InvalidOperationException("Not able to add the queue to the pool.");
            }
            else
            {
                queue.Start();
            }

            return queue;
        }
Ejemplo n.º 11
0
        private BrokerController(BrokerSetting setting)
        {
            Setting = setting ?? new BrokerSetting();
            _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
            _messageStore = ObjectContainer.Resolve<IMessageStore>();
            _consumeOffsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
            _queueStore = ObjectContainer.Resolve<IQueueStore>();
            _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
            _chunkReadStatisticService = ObjectContainer.Resolve<IChunkStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.ProducerAddress, Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.ConsumerAddress, Setting.SocketSetting);
            _adminSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.AdminAddress, Setting.SocketSetting);

            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();

            _service = new ConsoleEventHandlerService();
            _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
        }
Ejemplo n.º 12
0
        private BrokerController(BrokerSetting setting)
        {
            Setting                      = setting ?? new BrokerSetting();
            _producerManager             = ObjectContainer.Resolve <ProducerManager>();
            _consumerManager             = ObjectContainer.Resolve <ConsumerManager>();
            _messageStore                = ObjectContainer.Resolve <IMessageStore>();
            _consumeOffsetStore          = ObjectContainer.Resolve <IConsumeOffsetStore>();
            _queueStore                  = ObjectContainer.Resolve <IQueueStore>();
            _suspendedPullRequestManager = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _chunkReadStatisticService   = ObjectContainer.Resolve <IChunkStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.ProducerAddress, Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.ConsumerAddress, Setting.SocketSetting);
            _adminSocketRemotingServer    = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.AdminAddress, Setting.SocketSetting);

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _producerSocketRemotingServer.RegisterConnectionEventListener(new ProducerConnectionEventListener(this));
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();

            _service = new ConsoleEventHandlerService();
            _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
        }
Ejemplo n.º 13
0
        private BrokerController(BrokerSetting setting)
        {
            Setting = setting ?? new BrokerSetting();

            Setting.BrokerInfo.Valid();
            if (Setting.NameServerList == null || Setting.NameServerList.Count() == 0)
            {
                throw new ArgumentException("NameServerList is empty.");
            }

            _latestMessageIds               = new string[Setting.LatestMessageShowCount];
            _producerManager                = ObjectContainer.Resolve <ProducerManager>();
            _consumerManager                = ObjectContainer.Resolve <ConsumerManager>();
            _messageStore                   = ObjectContainer.Resolve <IMessageStore>();
            _consumeOffsetStore             = ObjectContainer.Resolve <IConsumeOffsetStore>();
            _queueStore                     = ObjectContainer.Resolve <IQueueStore>();
            _getTopicConsumeInfoListService = ObjectContainer.Resolve <GetTopicConsumeInfoListService>();
            _getConsumerListService         = ObjectContainer.Resolve <GetConsumerListService>();
            _scheduleService                = ObjectContainer.Resolve <IScheduleService>();
            _binarySerializer               = ObjectContainer.Resolve <IBinarySerializer>();
            _suspendedPullRequestManager    = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _tpsStatisticService            = ObjectContainer.Resolve <ITpsStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.BrokerInfo.ProducerAddress.ToEndPoint(), Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.BrokerInfo.ConsumerAddress.ToEndPoint(), Setting.SocketSetting);
            _adminSocketRemotingServer    = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.BrokerInfo.AdminAddress.ToEndPoint(), Setting.SocketSetting);

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _producerSocketRemotingServer.RegisterConnectionEventListener(new ProducerConnectionEventListener(this));
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();
            _nameServerRemotingClientList          = Setting.NameServerList.ToRemotingClientList("EQueueBroker." + Setting.BrokerInfo.BrokerName, Setting.SocketSetting).ToList();
            TaskScheduler.UnobservedTaskException += (sender, ex) =>
            {
                _logger.ErrorFormat("UnobservedTaskException occurred.", ex);
            };
        }
Ejemplo n.º 14
0
        private BrokerController(BrokerSetting setting)
        {
            Setting = setting ?? new BrokerSetting();

            Setting.BrokerInfo.Valid();
            if (Setting.NameServerList == null || Setting.NameServerList.Count() == 0)
            {
                throw new ArgumentException("NameServerList is empty.");
            }

            _latestMessageIds               = new string[Setting.LatestMessageShowCount];
            _producerManager                = ObjectContainer.Resolve <ProducerManager>();
            _consumerManager                = ObjectContainer.Resolve <ConsumerManager>();
            _messageStore                   = ObjectContainer.Resolve <IMessageStore>();
            _consumeOffsetStore             = ObjectContainer.Resolve <IConsumeOffsetStore>();
            _queueStore                     = ObjectContainer.Resolve <IQueueStore>();
            _getTopicConsumeInfoListService = ObjectContainer.Resolve <GetTopicConsumeInfoListService>();
            _getConsumerListService         = ObjectContainer.Resolve <GetConsumerListService>();
            _scheduleService                = ObjectContainer.Resolve <IScheduleService>();
            _binarySerializer               = ObjectContainer.Resolve <IBinarySerializer>();
            _suspendedPullRequestManager    = ObjectContainer.Resolve <SuspendedPullRequestManager>();
            _chunkReadStatisticService      = ObjectContainer.Resolve <IChunkStatisticService>();
            _tpsStatisticService            = ObjectContainer.Resolve <ITpsStatisticService>();

            _producerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ProducerRemotingServer", Setting.BrokerInfo.ProducerAddress.ToEndPoint(), Setting.SocketSetting);
            _consumerSocketRemotingServer = new SocketRemotingServer("EQueue.Broker.ConsumerRemotingServer", Setting.BrokerInfo.ConsumerAddress.ToEndPoint(), Setting.SocketSetting);
            _adminSocketRemotingServer    = new SocketRemotingServer("EQueue.Broker.AdminRemotingServer", Setting.BrokerInfo.AdminAddress.ToEndPoint(), Setting.SocketSetting);

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
            _producerSocketRemotingServer.RegisterConnectionEventListener(new ProducerConnectionEventListener(this));
            _consumerSocketRemotingServer.RegisterConnectionEventListener(new ConsumerConnectionEventListener(this));
            RegisterRequestHandlers();

            _service = new ConsoleEventHandlerService();
            _service.RegisterClosingEventHandler(eventCode => { Shutdown(); });
            _nameServerRemotingClientList = RemotingClientUtils.CreateRemotingClientList(Setting.NameServerList, Setting.SocketSetting).ToList();
        }
 public GetConsumerListService(ConsumerManager consumerManager, IConsumeOffsetStore consumeOffsetStore, IQueueStore queueStore)
 {
     _consumerManager    = consumerManager;
     _consumeOffsetStore = consumeOffsetStore;
     _queueStore         = queueStore;
 }
 public GetMessageDetailByQueueOffsetRequestHandler()
 {
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
     _messageStore     = ObjectContainer.Resolve <IMessageStore>();
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
 }
Ejemplo n.º 17
0
 public QueueManager(IConfigurationAndLogAccessor accessors, IQueueStore store) : this(accessors) {
     _store = store;
 }
 public UserNotificationController(IUnitOfWork unitOfWork, IMapper mapper, IQueueStore queueStore)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
 }
Ejemplo n.º 19
0
 public DeleteTopicRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionlessClient" /> class.
        /// </summary>
        internal ExceptionlessClient(IQueueStore store = null, IExceptionlessLog log = null) {
            _queueTimer = new Timer(OnQueueTimer, null, Timeout.Infinite, Timeout.Infinite);
            _log = log ?? new NullExceptionlessLog();

            try {
                _configuration = Config.ClientConfiguration.Create(this);
                Log.FormattedTrace(typeof(ExceptionlessClient), "Configuration Values: ApiKey={0}, EnableSSL={1}, Enabled={2}, ServerUrl={3}", _configuration.ApiKey, _configuration.EnableSSL, _configuration.Enabled, _configuration.ServerUrl);
            } catch (Exception ex) {
                Log.FormattedError(typeof(ExceptionlessClient), "Critical error in ExceptionlessClient constructor: {0}", ex.Message);
            }

            try {
                _localConfiguration = Config.LocalConfigurationDictionary.Create(_configuration.StoreId, this);
            } catch (Exception ex) {
                Log.FormattedError(typeof(ExceptionlessClient), "Critical error in ExceptionlessClient constructor: {0}", ex.Message);
            }

            _queue = new QueueManager(this, store);
            _queueTimer.Change(LocalConfiguration.QueuePoll, TimeSpan.Zero);
#if SILVERLIGHT
            NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
#else
            NetworkChange.NetworkAvailabilityChanged += NetworkChangeNetworkAvailabilityChanged;
#endif
        }
Ejemplo n.º 21
0
 public GetTopicConsumeInfoListService(ConsumerManager consumerManager, IConsumeOffsetStore consumeOffsetStore, IQueueStore queueStore, ITpsStatisticService tpsStatisticService)
 {
     _consumerManager     = consumerManager;
     _consumeOffsetStore  = consumeOffsetStore;
     _queueStore          = queueStore;
     _tpsStatisticService = tpsStatisticService;
 }
Ejemplo n.º 22
0
 public static Task WriteMessage <T>(this IQueueStore <T> queue, T message, CancellationToken cancellationToken)
 {
     return(queue.WriteMessage(message, null, null, cancellationToken));
 }
 public SetQueueConsumerVisibleRequestHandler()
 {
     _binarySerializer = IocManager.Instance.Resolve <ISerializer <byte[]> >();
     _queueStore       = IocManager.Instance.Resolve <IQueueStore>();
 }
Ejemplo n.º 24
0
 public GetTopicQueueInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
     _offsetStore      = ObjectContainer.Resolve <IConsumeOffsetStore>();
 }
Ejemplo n.º 25
0
        private void ValidateStore(IQueueStore store) {
            Assert.True(store.VerifyStoreIsUsable());

            // delete any old reports
            store.Cleanup(DateTime.Now);
            IEnumerable<Manifest> manifests = store.GetManifests(null);
            Assert.Equal(manifests.Count(), 0);

            Error error = CreateSampleError();
            Exceptionless.Queue.QueueManager.SerializeErrorExtendedData(_accessor, error);
            store.Enqueue(error);
            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests) {
                m.Attempts++;
                m.LastAttempt = DateTime.Now;
                store.UpdateManifest(m);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 1);

            foreach (Manifest m in manifests) {
                Assert.Equal(m.Attempts, 1);
                Assert.NotEqual(m.LastAttempt, DateTime.MinValue);

                Error e = store.GetError(m.Id);
                ValidateSampleError(e);

                store.Delete(m.Id);
            }

            manifests = store.GetManifests(null);

            Assert.NotNull(manifests);
            Assert.Equal(manifests.Count(), 0);
        }
Ejemplo n.º 26
0
 public CreateTopicRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _queueService = ObjectContainer.Resolve<IQueueStore>();
 }
 public GetTopicQueueIdsForConsumerRequestHandler()
 {
     _queueService = ObjectContainer.Resolve<IQueueStore>();
 }
Ejemplo n.º 28
0
 public AddQueueRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
 }
 public QueryTopicQueueInfoRequestHandler()
 {
     _binarySerializer = IocManager.Instance.Resolve <ISerializer <byte[]> >();
     _queueStore       = IocManager.Instance.Resolve <IQueueStore>();
     _offsetStore      = IocManager.Instance.Resolve <IConsumeOffsetStore>();
 }
 public SetQueueProducerVisibleRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
 }
 public GetTopicQueueInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
 }
 public GetTopicQueueIdsForConsumerRequestHandler()
 {
     _queueStore = IocManager.Instance.Resolve <IQueueStore>();
 }
Ejemplo n.º 33
0
 public QueueManager(IConfigurationAndLogAccessor accessors, IQueueStore store) : this(accessors) {
     _store = store;
 }
 public GetTopicQueueIdsForProducerRequestHandler()
 {
     _queueStore = ObjectContainer.Resolve <IQueueStore>();
 }
Ejemplo n.º 35
0
 public CreateTopicRequestHandler()
 {
     _binarySerializer = IocManager.Instance.Resolve <ISerializer <byte[]> >();
     _queueStore       = IocManager.Instance.Resolve <IQueueStore>();
 }
 public SetQueueProducerVisibleRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
 }
 public GetTopicQueueIdsForProducerRequestHandler()
 {
     _queueStore = ObjectContainer.Resolve<IQueueStore>();
 }