Пример #1
0
        void ITransport.Start(Address address)
        {
            MessageReceiver.Init(address, IsTransactional);

            var returnAddressForFailures = address;

            //figure out if this transport is the one feeding messages into the unicastbus
            if (returnAddressForFailures.Queue.ToLower().EndsWith(".worker") || address == Address.Local) //this is a hack until we can refactor the SLR to be a feature. "Worker" is there to catch the local worker in the distributor
            {
                //GetMasterNodeAddress returns Address.Local if no masternode is defined so we can safely call this for all endpoints
                returnAddressForFailures = Configure.Instance.GetMasterNodeAddress();

                if (address != returnAddressForFailures)
                {
                    Logger.InfoFormat("Worker started, failures will be redirected to {0}", returnAddressForFailures);
                }
            }

            FailureManager.Init(returnAddressForFailures);

            Logger.DebugFormat("Going to start [{0}] receiving thread/s for Address [{1}].", numberOfWorkerThreads, address);
            for (int i = 0; i < numberOfWorkerThreads; i++)
            {
                AddWorkerThread().Start();
            }
        }
Пример #2
0
 void ITransport.Start(Address address)
 {
     MessageReceiver.Init(address, IsTransactional);
     FailureManager.Init(address);
     Logger.DebugFormat("Going to start [{0}] receiving thread/s for Address [{1}].", numberOfWorkerThreads, address);
     for (int i = 0; i < numberOfWorkerThreads; i++)
     {
         AddWorkerThread().Start();
     }
 }
        void ITransport.Start(Address address)
        {
            MessageReceiver.Init(address, IsTransactional);
            FailureManager.Init(address);

            for (int i = 0; i < numberOfWorkerThreads; i++)
            {
                AddWorkerThread().Start();
            }
        }
Пример #4
0
        /// <summary>
        /// Starts the transport listening for messages on the given local address.
        /// </summary>
        public void Start(Address address)
        {
            if (isStarted)
            {
                throw new InvalidOperationException("The transport is already started");
            }

            receiveAddress = address;

            var returnAddressForFailures = address;

            var workerRunsOnThisEndpoint = settings.GetOrDefault <bool>("Worker.Enabled");

            if (workerRunsOnThisEndpoint &&
                (returnAddressForFailures.Queue.ToLower().EndsWith(".worker") || address == config.LocalAddress))
            //this is a hack until we can refactor the SLR to be a feature. "Worker" is there to catch the local worker in the distributor
            {
                returnAddressForFailures = settings.Get <Address>("MasterNode.Address");

                Logger.InfoFormat("Worker started, failures will be redirected to {0}", returnAddressForFailures);
            }

            FailureManager.Init(returnAddressForFailures);

            firstLevelRetries = new FirstLevelRetries(TransactionSettings.MaxRetries, FailureManager, CriticalError);

            InitializePerformanceCounters();

            throughputLimiter = new ThroughputLimiter();

            throughputLimiter.Start(MaximumMessageThroughputPerSecond);

            StartReceiver();

            if (MaximumMessageThroughputPerSecond > 0)
            {
                Logger.InfoFormat("Transport: {0} started with its throughput limited to {1} msg/sec", receiveAddress,
                                  MaximumMessageThroughputPerSecond);
            }

            isStarted = true;
        }