Exemple #1
0
    void ConfiguringDistributor(BusConfiguration busConfiguration)
    {
        #region ConfiguringDistributor
        // Running the Distributor and a Worker
        busConfiguration.AsMSMQMasterNode();
        // or
        busConfiguration.RunMSMQDistributor();

        // Running the Distributor only
        busConfiguration.RunMSMQDistributor(false);

        #endregion
    }
Exemple #2
0
        void ConfiguringDistributor(BusConfiguration busConfiguration)
        {
            #region ConfiguringDistributor
            // --------------------------------------
            // Running the Distributor and a Worker
            busConfiguration.AsMSMQMasterNode();
            //or
            busConfiguration.RunMSMQDistributor();
            // --------------------------------------

            // --------------------------------------
            // Running the Distributor only
            busConfiguration.RunMSMQDistributor(false);
            // --------------------------------------

            #endregion
        }
        public void Foo()
        {
            #region ConfiguringDistributor-V5
            var configuration = new BusConfiguration();

            // --------------------------------------
            // Running the Distributor and a Worker
            configuration.AsMSMQMasterNode();
            //or
            configuration.RunMSMQDistributor();
            // --------------------------------------

            // --------------------------------------
            // Running the Distributor only
            configuration.RunMSMQDistributor(false);
            // --------------------------------------
            #endregion
        }
        public void Customize(BusConfiguration builder)
        {
            var args = Environment.GetCommandLineArgs();

            bool worker = false, master = false, distributor = false;

            foreach (var arg in args)
            {
                var profilename = arg.ToLower();

                if (profilename == "nservicebus.msmqworker")
                {
                    worker = true;
                }

                if (profilename == "nservicebus.msmqmaster")
                {
                    master = true;
                }

                if (profilename == "nservicebus.msmqdistributor")
                {
                    distributor = true;
                }
            }

            if (!(worker || master || distributor))
            {
                return;
            }

            var numberOfProfileEnabled = 0;

            if (worker)
            {
                numberOfProfileEnabled++;
            }

            if (master)
            {
                numberOfProfileEnabled++;
            }

            if (distributor)
            {
                numberOfProfileEnabled++;
            }

            if (numberOfProfileEnabled > 1)
            {
                throw new ConfigurationErrorsException("You can only enable one of the following profiles per endpoint Distributor, Master or Worker.");
            }

            if (worker)
            {
                builder.EnlistWithMSMQDistributor();
            }

            if (master)
            {
                builder.AsMSMQMasterNode();
            }

            if (distributor)
            {
                builder.RunMSMQDistributor(false);
            }
        }
        public void Customize(BusConfiguration builder)
        {
            var args = Environment.GetCommandLineArgs();

            bool worker = false, master = false, distributor = false;

            foreach (var arg in args)
            {
                var profilename = arg.ToLower();

                if (profilename == "nservicebus.msmqworker")
                {
                    worker = true;
                }

                if (profilename == "nservicebus.msmqmaster")
                {
                    master = true;
                }

                if (profilename == "nservicebus.msmqdistributor")
                {
                    distributor = true;
                }
            }

            if (!(worker || master || distributor))
            {
                return;
            }

            var numberOfProfileEnabled = 0;

            if (worker)
            {
                numberOfProfileEnabled++;
            }

            if (master)
            {
                numberOfProfileEnabled++;
            }

            if (distributor)
            {
                numberOfProfileEnabled++;
            }

            if (numberOfProfileEnabled > 1)
            {
                throw new ConfigurationErrorsException("You can only enable one of the following profiles per endpoint Distributor, Master or Worker.");
            }

            if (worker)
            {
                builder.EnlistWithMSMQDistributor();
            }

            if (master)
            {
                builder.AsMSMQMasterNode();
            }

            if (distributor)
            {
                builder.RunMSMQDistributor(false);
            }
        }