Beispiel #1
0
        private void RegisterRhinoQueuesTransport(AbstractRhinoServiceBusConfiguration c, IBusContainerBuilder b, IServiceLocator l)
        {
            var busConfig = c.ConfigurationSection.Bus;
            var queueManagerConfiguration = new QueueManagerConfiguration();

            b.RegisterSingleton <ISubscriptionStorage>(() => (ISubscriptionStorage) new PhtSubscriptionStorage(
                                                           busConfig.SubscriptionPath,
                                                           l.Resolve <IMessageSerializer>(),
                                                           l.Resolve <IReflection>()));

            b.RegisterSingleton <ITransactionStrategy>(() => new TransactionScopeStrategy());

            b.RegisterSingleton <ITransport>(() => (ITransport) new RhinoQueuesTransport(
                                                 c.Endpoint,
                                                 l.Resolve <IEndpointRouter>(),
                                                 l.Resolve <IMessageSerializer>(),
                                                 c.ThreadCount,
                                                 busConfig.QueuePath,
                                                 c.IsolationLevel,
                                                 c.NumberOfRetries,
                                                 busConfig.EnablePerformanceCounters,
                                                 l.Resolve <IMessageBuilder <MessagePayload> >(),
                                                 queueManagerConfiguration,
                                                 l.Resolve <ITransactionStrategy>()));

            b.RegisterSingleton <IMessageBuilder <MessagePayload> >(() => (IMessageBuilder <MessagePayload>) new RhinoQueuesMessageBuilder(
                                                                        l.Resolve <IMessageSerializer>(),
                                                                        l.Resolve <IServiceLocator>()));

            b.RegisterSingleton <QueueManagerConfiguration>(() => queueManagerConfiguration);
        }
 public PersistentQueues(ILogger logger, IDelayedMessageCache<MessageId> delayedMessages, LightningQueueSettings settings)
 {
     _logger = logger;
     _delayedMessages = delayedMessages;
     _queueManagerConfiguration = settings.ToConfiguration();
     _queueManagers = new Cache<int, QueueManager>(port => new QueueManager(new IPEndPoint(IPAddress.Any, port), EsentPath + "." + port, _queueManagerConfiguration));
 }
Beispiel #3
0
 public PersistentQueues(ILogger logger, IDelayedMessageCache <MessageId> delayedMessages, LightningQueueSettings settings)
 {
     _logger                    = logger;
     _delayedMessages           = delayedMessages;
     _queueManagerConfiguration = settings.ToConfiguration();
     _queueManagers             = new Cache <int, QueueManager>(port => new QueueManager(new IPEndPoint(IPAddress.Any, port), EsentPath + "." + port, _queueManagerConfiguration));
 }
Beispiel #4
0
        public RhinoQueuesTransport(Uri endpoint,
                                    IEndpointRouter endpointRouter,
                                    IMessageSerializer messageSerializer,
                                    int threadCount,
                                    string path,
                                    IsolationLevel queueIsolationLevel,
                                    int numberOfRetries,
                                    bool enablePerformanceCounters,
                                    IMessageBuilder <MessagePayload> messageBuilder,
                                    QueueManagerConfiguration queueManagerConfiguration,
                                    ITransactionStrategy transactionStrategy)
        {
            this.endpoint                  = endpoint;
            this.queueIsolationLevel       = queueIsolationLevel;
            this.numberOfRetries           = numberOfRetries;
            this.enablePerformanceCounters = enablePerformanceCounters;
            this.messageBuilder            = messageBuilder;
            this.queueManagerConfiguration = queueManagerConfiguration;
            this.transactionStrategy       = transactionStrategy;
            this.endpointRouter            = endpointRouter;
            this.messageSerializer         = messageSerializer;
            this.threadCount               = threadCount;
            this.path = path;

            queueName = endpoint.GetQueueName();

            threads = new Thread[threadCount];

            // This has to be the first subscriber to the transport events
            // in order to successfully handle the errors semantics
            new ErrorAction(numberOfRetries).Init(this);
            messageBuilder.Initialize(this.Endpoint);
        }
Beispiel #5
0
 public SenderActions(string database, Guid instanceId, QueueManagerConfiguration configuration)
     : base(database, instanceId)
 {
     _logger = LogManager.GetLogger(typeof(GlobalActions));
     _configuration = configuration;
     _outgoingPath = Path.Combine(database, ".outgoing");
     _outgoingHistoryPath = Path.Combine(database, ".outgoingHistory");
 }
 public QueueStorage(string database, QueueManagerConfiguration configuration)
 {
     this.configuration = configuration;
     this.database = database;
     path = database;
     if (Path.IsPathRooted(database) == false)
         path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database);
     this.database = Path.Combine(path, Path.GetFileName(database));
     Api.JetCreateInstance(out instance, database + Guid.NewGuid());
 }
 public QueueStorage(string database, QueueManagerConfiguration configuration)
 {
     _configuration = configuration;
     _database      = database;
     _path          = database;
     if (Path.IsPathRooted(database) == false)
     {
         _path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database);
     }
     _database = Path.Combine(_path, Path.GetFileName(database));
     Api.JetCreateInstance(out _instance, database + Guid.NewGuid());
 }
        public QueueManager(IPEndPoint endpoint, string path, QueueManagerConfiguration configuration, ILogger logger = null)
        {
            Configuration = configuration;

            _endpoint = endpoint;
            _path = path;
            _logger = logger ?? LogManager.GetLogger(GetType());
            _queueStorage = new QueueStorage(path, configuration);
            _queueStorage.Initialize();

            _queueStorage.Global(actions =>
            {
                _receivedMsgs.Add(actions.GetAlreadyReceivedMessageIds());
            });

            HandleRecovery();
        }
 public void default_settings_match_lightning_queues_default_configuration()
 {
     var defaultConfiguration = new QueueManagerConfiguration();
     //could probably do this without constructing the queue manager, but probably safer down the road this way
     using (var queues = new PersistentQueues(new RecordingLogger(), new DelayedMessageCache<MessageId>(), new LightningQueueSettings()))
     {
         queues.ClearAll();
         queues.Start(new[] {new LightningUri("lq.tcp://localhost:2424/some_queue")});
         var queueManager = queues.ManagerFor(2424, true);
         var actual = queueManager.Configuration;
         actual.EnableOutgoingMessageHistory.ShouldEqual(defaultConfiguration.EnableOutgoingMessageHistory);
         actual.EnableProcessedMessageHistory.ShouldEqual(defaultConfiguration.EnableProcessedMessageHistory);
         actual.NumberOfMessagesToKeepInOutgoingHistory.ShouldEqual(defaultConfiguration.NumberOfMessagesToKeepInOutgoingHistory);
         actual.NumberOfMessagesToKeepInProcessedHistory.ShouldEqual(defaultConfiguration.NumberOfMessagesToKeepInProcessedHistory);
         actual.NumberOfReceivedMessageIdsToKeep.ShouldEqual(defaultConfiguration.NumberOfReceivedMessageIdsToKeep);
         actual.OldestMessageInOutgoingHistory.ShouldEqual(defaultConfiguration.OldestMessageInOutgoingHistory);
         actual.OldestMessageInProcessedHistory.ShouldEqual(defaultConfiguration.OldestMessageInProcessedHistory);
     }
 }
Beispiel #10
0
        private void RegisterRhinoQueuesOneWay(AbstractRhinoServiceBusConfiguration c, IBusContainerBuilder b, IServiceLocator l)
        {
            var oneWayConfig = (OnewayRhinoServiceBusConfiguration)c;
            var busConfig    = c.ConfigurationSection.Bus;
            var queueManagerConfiguration = new QueueManagerConfiguration();

            b.RegisterSingleton <IMessageBuilder <MessagePayload> >(() => (IMessageBuilder <MessagePayload>) new RhinoQueuesMessageBuilder(
                                                                        l.Resolve <IMessageSerializer>(),
                                                                        l.Resolve <IServiceLocator>()));

            b.RegisterSingleton <IOnewayBus>(() => (IOnewayBus) new RhinoQueuesOneWayBus(
                                                 oneWayConfig.MessageOwners,
                                                 l.Resolve <IMessageSerializer>(),
                                                 busConfig.QueuePath,
                                                 busConfig.EnablePerformanceCounters,
                                                 l.Resolve <IMessageBuilder <MessagePayload> >(),
                                                 queueManagerConfiguration));

            b.RegisterSingleton <QueueManagerConfiguration>(() => queueManagerConfiguration);
        }
        public void default_settings_match_lightning_queues_default_configuration()
        {
            var defaultConfiguration = new QueueManagerConfiguration();

            //could probably do this without constructing the queue manager, but probably safer down the road this way
            using (var queues = new PersistentQueues(new RecordingLogger(), new DelayedMessageCache <MessageId>(), new LightningQueueSettings()))
            {
                queues.ClearAll();
                queues.Start(new[] { new LightningUri("lq.tcp://localhost:2424/some_queue") });
                var queueManager = queues.ManagerFor(2424, true);
                var actual       = queueManager.Configuration;
                actual.EnableOutgoingMessageHistory.ShouldEqual(defaultConfiguration.EnableOutgoingMessageHistory);
                actual.EnableProcessedMessageHistory.ShouldEqual(defaultConfiguration.EnableProcessedMessageHistory);
                actual.NumberOfMessagesToKeepInOutgoingHistory.ShouldEqual(defaultConfiguration.NumberOfMessagesToKeepInOutgoingHistory);
                actual.NumberOfMessagesToKeepInProcessedHistory.ShouldEqual(defaultConfiguration.NumberOfMessagesToKeepInProcessedHistory);
                actual.NumberOfReceivedMessageIdsToKeep.ShouldEqual(defaultConfiguration.NumberOfReceivedMessageIdsToKeep);
                actual.OldestMessageInOutgoingHistory.ShouldEqual(defaultConfiguration.OldestMessageInOutgoingHistory);
                actual.OldestMessageInProcessedHistory.ShouldEqual(defaultConfiguration.OldestMessageInProcessedHistory);
            }
        }
        public RhinoQueuesOneWayBus(MessageOwner[] messageOwners, IMessageSerializer messageSerializer, string path, bool enablePerformanceCounters, IMessageBuilder <MessagePayload> messageBuilder, QueueManagerConfiguration queueManagerConfiguration, ITransactionStrategy transactionStrategy)
            : base(NullEndpoint, new EndpointRouter(), messageSerializer, 1, path, IsolationLevel.ReadCommitted, 5, enablePerformanceCounters, messageBuilder, queueManagerConfiguration, transactionStrategy)

        {
            this.messageOwners = new MessageOwnersSelector(messageOwners, new EndpointRouter());
            Start();
        }
Beispiel #13
0
 public RevertingQueueManager(IPEndPoint endpoint, string path, QueueManagerConfiguration configuration, ILogger logger)
     : base(endpoint, path, configuration, logger)
 {
 }
Beispiel #14
0
 public SenderActions(JET_INSTANCE instance, ColumnsInformation columnsInformation, string database, Guid instanceId, QueueManagerConfiguration configuration)
     : base(instance, columnsInformation, database, instanceId)
 {
     this.configuration = configuration;
 }
 public GlobalActions(JET_INSTANCE instance, ColumnsInformation columnsInformation, string database, Guid instanceId, QueueManagerConfiguration configuration, ILogger logger)
     : base(instance, columnsInformation, database, instanceId, logger)
 {
     this.configuration = configuration;
     _logger = logger;
 }
 public SenderActions(JET_INSTANCE instance, ColumnsInformation columnsInformation, string database, Guid instanceId, QueueManagerConfiguration configuration)
     : base(instance, columnsInformation, database, instanceId)
 {
     this.configuration = configuration;
 }
Beispiel #17
0
 public DbQueueManager(IStorageManager storageMgr, AuthorizationManager authMgr) : base(storageMgr, authMgr, QueueManagerConfiguration.GetDefaultConfiguration())
 {
 }
 public RevertingQueueManager(IPEndPoint endpoint, string path, QueueManagerConfiguration configuration, ILogger logger)
     : base(endpoint, path, configuration, logger)
 {
 }
Beispiel #19
0
 public QueueStorage(string database, QueueManagerConfiguration configuration)
 {
     _configuration = configuration;
     _database = (!Path.IsPathRooted(database) ? Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database) : database);
     _instanceId = Guid.NewGuid();
 }