コード例 #1
0
ファイル: Worker.cs プロジェクト: rasmuskl/Rebus
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages)
        {
            this.receiveMessages        = receiveMessages;
            this.serializeMessages      = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.errorTracker           = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #2
0
ファイル: Transport.cs プロジェクト: kehinze/Hermes
 public Transport(IReceiveMessages messageReceiver, IContainer container, ModulePipeFactory<IncomingMessageContext> incomingPipeline, ModulePipeFactory<OutgoingMessageContext> outgoingPipeline)
 {
     this.messageReceiver = messageReceiver;
     this.container = container;
     this.incomingPipeline = incomingPipeline;
     this.outgoingPipeline = outgoingPipeline;
 }
コード例 #3
0
ファイル: OutboundService.cs プロジェクト: JanRou/Rebus
        void DoWork(IReceiveMessages messageQueue)
        {
            try
            {
                using (var tx = new TransactionScope())
                {
                    var ctx = new AmbientTransactionContext();
                    var receivedTransportMessage = messageQueue.ReceiveMessage(ctx);

                    if (receivedTransportMessage == null) return;

                    try
                    {
                        SendMessage(receivedTransportMessage);

                        tx.Complete();
                    }
                    catch (Exception e)
                    {
                        log.Error(e, "Could not send message {0} to destination URI {1} - waiting 1 sec before retrying",
                                  receivedTransportMessage.Id, destinationUri);

                        Thread.Sleep(TimeSpan.FromSeconds(1));
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("Unhandled exception during receive operation", e);
            }
        }
コード例 #4
0
        void DoWork(IReceiveMessages messageQueue)
        {
            try
            {
                using (var tx = new TransactionScope())
                {
                    var ctx = new AmbientTransactionContext();
                    var receivedTransportMessage = messageQueue.ReceiveMessage(ctx);

                    if (receivedTransportMessage == null)
                    {
                        return;
                    }

                    try
                    {
                        SendMessage(receivedTransportMessage);

                        tx.Complete();
                    }
                    catch (Exception e)
                    {
                        log.Error(e, "Could not send message {0} to destination URI {1} - waiting 1 sec before retrying",
                                  receivedTransportMessage.Id, destinationUri);

                        Thread.Sleep(TimeSpan.FromSeconds(1));
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("Unhandled exception during receive operation", e);
            }
        }
コード例 #5
0
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages,
                      IStoreTimeouts storeTimeouts,
                      IEnumerable <IUnitOfWorkManager> unitOfWorkManagers,
                      ConfigureAdditionalBehavior configureAdditionalBehavior,
                      MessageLogger messageLogger)
        {
            this.receiveMessages             = receiveMessages;
            this.serializeMessages           = serializeMessages;
            this.mutateIncomingMessages      = mutateIncomingMessages;
            this.unitOfWorkManagers          = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger               = messageLogger;
            this.errorTracker                = errorTracker;
            dispatcher                       = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage  += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessing"/> class.
        /// </summary>
        /// <param name="receiveMessages">The receive messages.</param>
        /// <param name="messageContextFactory">The message context factory.</param>
        /// <param name="queueWaitFactory">The queue wait factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="processMessage">The process message.</param>
        /// <param name="receivePoisonMessage">The receive poison message.</param>
        /// <param name="rollbackMessage">rolls back a message when an exception occurs</param>
        public MessageProcessing(
            IReceiveMessagesFactory receiveMessages,
            IMessageContextFactory messageContextFactory,
            IQueueWaitFactory queueWaitFactory,
            ILogFactory log,
            ProcessMessage processMessage,
            IReceivePoisonMessage receivePoisonMessage,
            IRollbackMessage rollbackMessage)
        {
            Guard.NotNull(() => receiveMessages, receiveMessages);
            Guard.NotNull(() => messageContextFactory, messageContextFactory);
            Guard.NotNull(() => queueWaitFactory, queueWaitFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => processMessage, processMessage);
            Guard.NotNull(() => receivePoisonMessage, receivePoisonMessage);
            Guard.NotNull(() => rollbackMessage, rollbackMessage);

            _receiveMessages       = receiveMessages.Create();
            _messageContextFactory = messageContextFactory;
            _log                  = log.Create();
            _processMessage       = processMessage;
            _receivePoisonMessage = receivePoisonMessage;
            _rollbackMessage      = rollbackMessage;

            _noMessageToProcessBackOffHelper      = new Lazy <IQueueWait>(queueWaitFactory.CreateQueueDelay);
            _seriousExceptionProcessBackOffHelper = new Lazy <IQueueWait>(queueWaitFactory.CreateFatalErrorDelay);
        }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesPolicyDecorator" /> class.
 /// </summary>
 public ReceiveMessagesPolicyDecorator(IPolicies policies,
                                       IReceiveMessages handler)
 {
     Guard.NotNull(() => policies, policies);
     Guard.NotNull(() => handler, handler);
     _policies = policies;
     _handler  = handler;
 }
コード例 #8
0
        protected override void DoSetUp()
        {
            factory = new TFactory();

            var transports = factory.Create();

            sender   = transports.Item1;
            receiver = transports.Item2;
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: JanRou/Rebus
        static IEnumerable<ReceivedTransportMessage> GetAllTheMessages(IReceiveMessages messageQueue, ITransactionContext transactionContext)
        {
            var messages = new List<ReceivedTransportMessage>();
            ReceivedTransportMessage transportMessage;
            while ((transportMessage = messageQueue.ReceiveMessage(transactionContext)) != null)
            {
                messages.Add(transportMessage);
            }

            return messages;
        }
コード例 #10
0
        /// <summary>
        /// Uses the specified implementation of <see cref="IReceiveMessages"/> to receive messages
        /// </summary>
        public void UseReceiver(IReceiveMessages receiveMessages)
        {
            Backbone.ReceiveMessages = receiveMessages;

            // if we see the OneWayClientGag, the bus will not be able to receive messages
            // - therefore, we configure the behavior
            if (receiveMessages is OneWayClientGag)
            {
                Backbone.AddConfigurationStep(s => s.AdditionalBehavior.EnterOneWayClientMode());
            }
        }
コード例 #11
0
        public RijndaelEncryptionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages, string ivBase64, string keyBase64)
        {
            this.innerSendMessages    = innerSendMessages;
            this.innerReceiveMessages = innerReceiveMessages;

            Rijndael.IV  = Convert.FromBase64String(ivBase64);
            Rijndael.Key = Convert.FromBase64String(keyBase64);

            encryptor = Rijndael.CreateEncryptor();
            decryptor = Rijndael.CreateDecryptor();
        }
コード例 #12
0
 public MessageProcessingWrapper()
 {
     _fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
     ReceiveMessages = _fixture.Create<IReceiveMessages>();
     var factory = _fixture.Create<IReceiveMessagesFactory>();
     factory.Create().ReturnsForAnyArgs(ReceiveMessages);
     _fixture.Inject(factory);
     MessageContextFactory = _fixture.Create<IMessageContextFactory>();
     _fixture.Inject(ReceiveMessages);
     _fixture.Inject(MessageContextFactory);
 }
コード例 #13
0
        public RijndaelEncryptionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages, string ivBase64, string keyBase64)
        {
            this.innerSendMessages = innerSendMessages;
            this.innerReceiveMessages = innerReceiveMessages;

            Rijndael.IV = Convert.FromBase64String(ivBase64);
            Rijndael.Key = Convert.FromBase64String(keyBase64);

            encryptor = Rijndael.CreateEncryptor();
            decryptor = Rijndael.CreateDecryptor();
        }
コード例 #14
0
        void Initialize(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages)
        {
            this.storeTimeouts = storeTimeouts;

            rebusBus = new RebusBus(this, sendMessages, receiveMessages, null, null, null, new JsonMessageSerializer(),
                                    new TrivialPipelineInspector(), new ErrorTracker(receiveMessages.InputQueueAddress + ".error"));
            bus = rebusBus;

            timer.Interval = 300;
            timer.Elapsed += CheckCallbacks;
        }
コード例 #15
0
        static IEnumerable <ReceivedTransportMessage> GetAllTheMessages(IReceiveMessages messageQueue, ITransactionContext transactionContext)
        {
            var messages = new List <ReceivedTransportMessage>();
            ReceivedTransportMessage transportMessage;

            while ((transportMessage = messageQueue.ReceiveMessage(transactionContext)) != null)
            {
                messages.Add(transportMessage);
            }

            return(messages);
        }
コード例 #16
0
            public MessageProcessingWrapper()
            {
                _fixture        = new Fixture().Customize(new AutoNSubstituteCustomization());
                ReceiveMessages = _fixture.Create <IReceiveMessages>();
                var factory = _fixture.Create <IReceiveMessagesFactory>();

                factory.Create().ReturnsForAnyArgs(ReceiveMessages);
                _fixture.Inject(factory);
                MessageContextFactory = _fixture.Create <IMessageContextFactory>();
                _fixture.Inject(ReceiveMessages);
                _fixture.Inject(MessageContextFactory);
            }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="headers">The headers.</param>
 /// <param name="getTime">The get time.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public ReceiveMessagesDecorator(IMetrics metrics,
     IHeaders headers,
     IGetTimeFactory getTime,
     IReceiveMessages handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _meter = metrics.Meter($"{connectionInformation.QueueName}.{name}.ReceiveMessageMeter", Units.Items);
     _waitTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.WaitForDeQueueMeter", Units.None);
     _handler = handler;
     _getTime = getTime;
     _headers = headers;
 }
コード例 #18
0
ファイル: TimeoutService.cs プロジェクト: ninocrudele/Rebus
        void Initialize(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages, string errorQueueName)
        {
            var errorQueuePath = MsmqUtil.GetPath(errorQueueName);

            MsmqUtil.EnsureMessageQueueExists(errorQueuePath);
            MsmqUtil.EnsureMessageQueueIsTransactional(errorQueuePath);

            rebusBus = new RebusBus(this, sendMessages, receiveMessages, null, null, null,
                                    new JsonMessageSerializer(),
                                    new TrivialPipelineInspector(),
                                    new ErrorTracker(errorQueueName),
                                    storeTimeouts, new ConfigureAdditionalBehavior());
        }
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="getTime">The get time.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public ReceiveMessagesDecorator(IMetrics metrics,
                                        IHeaders headers,
                                        IGetTimeFactory getTime,
                                        IReceiveMessages handler,
                                        IConnectionInformation connectionInformation)
        {
            var name = "ReceiveMessages";

            _meter     = metrics.Meter($"{connectionInformation.QueueName}.{name}.ReceiveMessageMeter", Units.Items);
            _waitTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.WaitForDeQueueMeter", Units.None);
            _handler   = handler;
            _getTime   = getTime;
            _headers   = headers;
        }
コード例 #20
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline)
        {
            this.activateHandlers       = activateHandlers;
            this.sendMessages           = sendMessages;
            this.receiveMessages        = receiveMessages;
            this.storeSubscriptions     = storeSubscriptions;
            this.determineDestination   = determineDestination;
            this.serializeMessages      = serializeMessages;
            this.storeSagaData          = storeSagaData;
            this.inspectHandlerPipeline = inspectHandlerPipeline;

            rebusId = Interlocked.Increment(ref rebusIdCounter);

            log.Info("Rebus bus created");
        }
コード例 #21
0
 protected Worker CreateWorker(IReceiveMessages receiveMessages, IActivateHandlers activateHandlers,
                               IInspectHandlerPipeline inspectHandlerPipeline      = null,
                               IEnumerable <IUnitOfWorkManager> unitOfWorkManagers = null,
                               IErrorTracker errorTracker = null)
 {
     return(new Worker(errorTracker ?? new ErrorTracker("error"),
                       receiveMessages,
                       activateHandlers,
                       new InMemorySubscriptionStorage(),
                       new JsonMessageSerializer(),
                       new SagaDataPersisterForTesting(),
                       inspectHandlerPipeline ?? new TrivialPipelineInspector(),
                       "Just some test worker",
                       new DeferredMessageHandlerForTesting(),
                       new IncomingMessageMutatorPipelineForTesting(),
                       null,
                       unitOfWorkManagers ?? new IUnitOfWorkManager[0],
                       new ConfigureAdditionalBehavior()));
 }
コード例 #22
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker)
        {
            this.activateHandlers       = activateHandlers;
            this.sendMessages           = sendMessages;
            this.receiveMessages        = receiveMessages;
            this.storeSubscriptions     = storeSubscriptions;
            this.determineDestination   = determineDestination;
            this.serializeMessages      = serializeMessages;
            this.storeSagaData          = storeSagaData;
            this.inspectHandlerPipeline = inspectHandlerPipeline;
            this.errorTracker           = errorTracker;

            batch   = new RebusBatchOperations(determineDestination, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId = Interlocked.Increment(ref rebusIdCounter);

            log.Info("Rebus bus created");
        }
コード例 #23
0
ファイル: WorkerFixtureBase.cs プロジェクト: plillevold/Rebus
 protected Worker CreateWorker(IReceiveMessages receiveMessages, IActivateHandlers activateHandlers, 
     IInspectHandlerPipeline inspectHandlerPipeline = null,
     IEnumerable<IUnitOfWorkManager> unitOfWorkManagers = null,
     IErrorTracker errorTracker = null)
 {
     return new Worker(errorTracker ??  new ErrorTracker("error"),
                       receiveMessages,
                       activateHandlers,
                       new InMemorySubscriptionStorage(),
                       new JsonMessageSerializer(),
                       new SagaDataPersisterForTesting(),
                       inspectHandlerPipeline ?? new TrivialPipelineInspector(),
                       "Just some test worker",
                       new DeferredMessageHandlerForTesting(),
                       new IncomingMessageMutatorPipelineForTesting(),
                       null,
                       unitOfWorkManagers ?? new IUnitOfWorkManager[0],
                       new ConfigureAdditionalBehavior());
 }
コード例 #24
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineMessageOwnership">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        /// <param name="storeTimeouts">Optionally provides an internal timeout manager to be used instead of sending timeout requests to an external timeout manager</param>
        /// <param name="configureAdditionalBehavior"></param>
        public RebusBus(
            IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData,
            IDetermineMessageOwnership determineMessageOwnership, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker,
            IStoreTimeouts storeTimeouts, ConfigureAdditionalBehavior configureAdditionalBehavior)
        {
            this.activateHandlers            = activateHandlers;
            this.sendMessages                = sendMessages;
            this.receiveMessages             = receiveMessages;
            this.storeSubscriptions          = storeSubscriptions;
            this.determineMessageOwnership   = determineMessageOwnership;
            this.serializeMessages           = serializeMessages;
            this.storeSagaData               = storeSagaData;
            this.inspectHandlerPipeline      = inspectHandlerPipeline;
            this.errorTracker                = errorTracker;
            this.storeTimeouts               = storeTimeouts;
            this.configureAdditionalBehavior = configureAdditionalBehavior;

            batch   = new RebusBatchOperations(determineMessageOwnership, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId       = Interlocked.Increment(ref rebusIdCounter);
            continuations = new RebusSynchronizationContext();

            log.Info("Rebus bus {0} created", rebusId);

            if (storeTimeouts == null)
            {
                var timeoutManagerEndpointAddress = RebusConfigurationSection
                                                    .GetConfigurationValueOrDefault(s => s.TimeoutManagerAddress, "rebus.timeout");

                log.Info("Using external timeout manager with input queue '{0}'", timeoutManagerEndpointAddress);
                timeoutManagerAddress = timeoutManagerEndpointAddress;
            }
            else
            {
                log.Info("Using internal timeout manager");
                timeoutManagerAddress = this.receiveMessages.InputQueueAddress;
                dueTimeoutScheduler   = new DueTimeoutScheduler(storeTimeouts, new DeferredMessageReDispatcher(this));
            }
        }
コード例 #25
0
ファイル: Worker.cs プロジェクト: pruiz/Rebus
        public Worker(
            IErrorTracker errorTracker,
            IReceiveMessages receiveMessages,
            IActivateHandlers activateHandlers,
            IStoreSubscriptions storeSubscriptions,
            ISerializeMessages serializeMessages,
            IStoreSagaData storeSagaData,
            IInspectHandlerPipeline inspectHandlerPipeline,
            string workerThreadName,
            IHandleDeferredMessage handleDeferredMessage,
            IMutateIncomingMessages mutateIncomingMessages,
            IStoreTimeouts storeTimeouts,
            IEnumerable<IUnitOfWorkManager> unitOfWorkManagers,
            ConfigureAdditionalBehavior configureAdditionalBehavior,
            MessageLogger messageLogger,
            RebusSynchronizationContext continuations)
        {
            this.receiveMessages = receiveMessages;
            this.serializeMessages = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.unitOfWorkManagers = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger = messageLogger;
            this.continuations = continuations;
            this.errorTracker = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop) { Name = workerThreadName };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public ReceiveMessagesDecorator(IReceiveMessages handler, ActivitySource tracer, IHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
コード例 #27
0
 public DequeueStrategy(IReceiveMessages receiveMessages)
 {
     this.receiveMessages = receiveMessages;
 }
コード例 #28
0
 public void UseReceiver(IReceiveMessages receiveMessages)
 {
     Backbone.ReceiveMessages = receiveMessages;
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReceiveMessagesDecorator"/> class.
 /// </summary>
 /// <param name="handler">The handler.</param>
 /// <param name="tracer">The tracer.</param>
 /// <param name="headers">The headers.</param>
 public ReceiveMessagesDecorator(IReceiveMessages handler, ITracer tracer, IHeaders headers)
 {
     _handler = handler;
     _tracer  = tracer;
     _headers = headers;
 }
コード例 #30
0
 protected override void SetupServer()
 {
     this.serverChannel = channelFactory.CreateReceiver();
     this.serverChannel.Bind(endpoint);
 }
コード例 #31
0
 public MemoryPublishMessages(IReceiveMessages receiveMessages)
 {
     _receiveMessages = receiveMessages;
 }
コード例 #32
0
 public MemorySendMessages(IReceiveMessages receiveMessages)
 {
     _receiveMessages = receiveMessages;
 }
コード例 #33
0
 public void Start()
 {
     _messageReceiver = _topicReceiverFactory.GetInstance();
     _messageReceiver.AddConsumer(_consumer);
 }
コード例 #34
0
ファイル: DequeueStrategy.cs プロジェクト: sonbua/async-dolls
 public DequeueStrategy(IReceiveMessages receiveMessages)
 {
     this.receiveMessages = receiveMessages;
 }
コード例 #35
0
 public RijndaelEncryptionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages, string keyBase64)
 {
     this.innerSendMessages = innerSendMessages;
     this.innerReceiveMessages = innerReceiveMessages;
     helper = new RijndaelHelper(keyBase64);
 }
コード例 #36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessing"/> class.
        /// </summary>
        /// <param name="receiveMessages">The receive messages.</param>
        /// <param name="messageContextFactory">The message context factory.</param>
        /// <param name="queueWaitFactory">The queue wait factory.</param>
        /// <param name="log">The log.</param>
        /// <param name="processMessage">The process message.</param>
        /// <param name="receivePoisonMessage">The receive poison message.</param>
        /// <param name="rollbackMessage">rolls back a message when an exception occurs</param>
        public MessageProcessing(
            IReceiveMessagesFactory receiveMessages,
            IMessageContextFactory messageContextFactory,
            IQueueWaitFactory queueWaitFactory,
            ILogFactory log,
            ProcessMessage processMessage,
            IReceivePoisonMessage receivePoisonMessage,
            IRollbackMessage rollbackMessage)
        {

            Guard.NotNull(() => receiveMessages, receiveMessages);
            Guard.NotNull(() => messageContextFactory, messageContextFactory);
            Guard.NotNull(() => queueWaitFactory, queueWaitFactory);
            Guard.NotNull(() => log, log);
            Guard.NotNull(() => processMessage, processMessage);
            Guard.NotNull(() => receivePoisonMessage, receivePoisonMessage);
            Guard.NotNull(() => rollbackMessage, rollbackMessage);

            _receiveMessages = receiveMessages.Create();
            _messageContextFactory = messageContextFactory;
            _log = log.Create();
            _processMessage = processMessage;
            _receivePoisonMessage = receivePoisonMessage;
            _rollbackMessage = rollbackMessage;

            _noMessageToProcessBackoffHelper = new Lazy<IQueueWait>(queueWaitFactory.CreateQueueDelay);
            _seriousExceptionProcessBackOffHelper = new Lazy<IQueueWait>(queueWaitFactory.CreateFatalErrorDelay);

        }
コード例 #37
0
ファイル: TimeoutService.cs プロジェクト: ninocrudele/Rebus
 public TimeoutService(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages)
 {
     Initialize(storeTimeouts, sendMessages, receiveMessages, DefaultErrorQueueName);
 }
コード例 #38
0
 /// <summary>
 /// Constructs the decorator with the specified implementations of <see cref="ISendMessages"/> and <see cref="IReceiveMessages"/>,
 /// storing the specified base 64-encoded key to be used when encrypting/decrypting messages
 /// </summary>
 public EncryptionAndCompressionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages)
 {
     this.innerSendMessages    = innerSendMessages;
     this.innerReceiveMessages = innerReceiveMessages;
 }
コード例 #39
0
ファイル: MessageUnit.cs プロジェクト: modulexcite/ServiceBus
 protected virtual Bus CreateBus(IReceiveMessages receiver, IOutgoingPipelineFactory outgoingPipelineFactory, IIncomingPipelineFactory incomingPipelineFactory)
 {
     return new Bus(this.configuration, new DequeueStrategy(receiver), outgoingPipelineFactory, incomingPipelineFactory);
 }
コード例 #40
0
 /// <summary>
 /// Uses the specified implementation of <see cref="IReceiveMessages"/> to receive messages
 /// </summary>
 public void UseReceiver(IReceiveMessages receiveMessages)
 {
     Backbone.ReceiveMessages = receiveMessages;
 }
コード例 #41
0
 protected virtual Bus CreateBus(IReceiveMessages receiver, IOutgoingPipelineFactory outgoingPipelineFactory, IIncomingPipelineFactory incomingPipelineFactory)
 {
     return(new Bus(this.configuration, new DequeueStrategy(receiver), outgoingPipelineFactory, incomingPipelineFactory));
 }
コード例 #42
0
 /// <summary>
 /// Constructs the decorator with the specified implementations of <see cref="ISendMessages"/> and <see cref="IReceiveMessages"/>,
 /// storing the specified base 64-encoded key to be used when encrypting/decrypting messages
 /// </summary>
 public RijndaelEncryptionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages, string keyBase64)
 {
     this.innerSendMessages    = innerSendMessages;
     this.innerReceiveMessages = innerReceiveMessages;
     helper = new RijndaelHelper(keyBase64);
 }
コード例 #43
0
 /// <summary>
 /// Constructs the decorator with the specified implementations of <see cref="ISendMessages"/> and <see cref="IReceiveMessages"/>,
 /// storing the specified base 64-encoded key to be used when encrypting/decrypting messages
 /// </summary>
 public EncryptionAndCompressionTransportDecorator(ISendMessages innerSendMessages, IReceiveMessages innerReceiveMessages)
 {
     this.innerSendMessages = innerSendMessages;
     this.innerReceiveMessages = innerReceiveMessages;
 }
コード例 #44
0
 public TimeoutService(IStoreTimeouts storeTimeouts, ISendMessages sendMessages, IReceiveMessages receiveMessages)
 {
     Initialize(storeTimeouts, sendMessages, receiveMessages);
 }