コード例 #1
0
ファイル: Broker.cs プロジェクト: jangocheng/TaskMQ
        private void LoadLatestConfiguration(bool tasksOnly = false)
        {
            if (!tasksOnly)// isAssemblyConfiguration reloading required
            {
                LoadAssemblyConfiguration();
            }

            ClearConfiguration();
            ConfigurationBroker cmain = Configurations.GetNewestMainConfiguration();

            if (cmain != null)
                cmain.Apply(this);// validate and apply
        }
コード例 #2
0
        private void LoadLatestConfiguration(bool tasksOnly = false)
        {
            if (!tasksOnly)
            {
                ConfigurationAssemblys casm = Configurations.GetNewestAssemblysConfiguration();
                if (casm != null)
                {
                    casm.Apply(this);
                    LoadAssemblys();
                }
            }

            ClearConfiguration();
            ConfigurationBroker cmain = Configurations.GetNewestMainConfiguration();

            if (cmain != null)
            {
                cmain.Apply(this);// validate and apply
            }
        }
コード例 #3
0
ファイル: Broker.cs プロジェクト: jangocheng/TaskMQ
        private void CreateRandomBenchConfiguration(bool tasksOnly = false)
        {
            if (!tasksOnly)// isAssemblyConfiguration reloading required
            {
                LoadAssemblyConfiguration();
            }
            ClearConfiguration();
            ConfigurationBroker cmain = Configurations.GetNewestMainConfiguration();

            cmain.Apply(this);

            var qinterface = QueueInterfaces.GetQueue(MemQueue.queueTypeName);
            QueueSpecificParameters parameters = new MemQueueParams();
            RegisterConnection("benchQ", qinterface, parameters, true);
            RegisterChannel("benchQ", "benchCH#" + 1, true);
            RegisterChannel("benchQ", "benchCH#" + 2, true);
            Random rnd = new Random(DateTime.UtcNow.Millisecond);
            for (int i = 0; i < 5; i++)
            {
                RegisterTempTask(new MetaTask
                {
                    ChannelName = "benchCH#" + (i % 2 == 0 ? 1 : 2),
                    intervalType = IntervalType.withoutInterval,
                    intervalValue = rnd.Next(0, 1000),
                    ModuleName = BenchModules.ModConsumer.ModuleName,
                    NameAndDescription = "bench task #" + (i + 1)
                }, null);
            }
            //for (int i = 0; i < 10000; i++)
            //{
            //    RegisterTempTask(new MetaTask
            //    {
            //        ChannelName = "benchCH#1",
            //        intervalType = IntervalType.intervalMilliseconds,
            //        intervalValue = rnd.Next(0, 1000),
            //        ModuleName = BenchModules.ModConsumer.ModuleName,
            //        NameAndDescription = "bench task #" + (i + 1)
            //    }, null);
            //}
        }