Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        public void Start(Address address)
        {
            if (isStarted)
                throw new InvalidOperationException("The transport is already started");

            receiveAddress = address;

            var returnAddressForFailures = address;

            if (Configure.Instance.WorkerRunsOnThisEndpoint()
                && (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
            {
                returnAddressForFailures = Configure.Instance.GetMasterNodeAddress();

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

            FailureManager.Init(returnAddressForFailures);

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

            InitializePerformanceCounters();

            throughputLimiter = new ThroughputLimiter();

            throughputLimiter.Start(maxMessageThroughputPerSecond);

            StartReceiver();

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

            isStarted = true;
        }
Exemplo n.º 3
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, Notifications);

            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;
        }