Exemplo n.º 1
0
        static void CreateProcessJob()
        {
            SwarmApi api = new SwarmApi("http://127.0.0.1:8000", "BBBBBBBB");
            var      job = new Job
            {
                Name               = "process",
                Group              = "DEFAULT",
                RetryCount         = 1,
                Performer          = Performer.SignalR,
                Executor           = Executor.Process,
                Description        = "iam a test job",
                Load               = 0,
                Owner              = "tester",
                Sharding           = 1,
                ShardingParameters = null,
                Properties         = new Dictionary <string, string>
                {
                    { SwarmConts.CronProperty, "*/15 * * * * ?" },
                    { SwarmConts.ApplicationProperty, "echo" },
                    { SwarmConts.LogPatternProperty, @"\[INF\]" },
                    {
                        SwarmConts.ArgumentsProperty,
                        "[INF]: %JobId% %TraceId% %Sharding% %Partition% %ShardingParameter%"
                    }
                }
            };

            api.Create(job).Wait();
        }
Exemplo n.º 2
0
        static void CreateReflectionJob()
        {
            SwarmApi api = new SwarmApi("http://127.0.0.1:8000", "BBBBBBBB");
            var      job = new Job
            {
                Name        = "test2",
                Group       = "DEFAULT",
                Performer   = Performer.SignalR,
                Description = "iam a test job",
                Owner       = "tester",
                Properties  = new Dictionary <string, string>
                {
                    { SwarmConsts.CronProperty, "*/15 * * * * ?" },
                    { SwarmConsts.ExecutorProperty, Executor.Reflection.ToString() },
                    { SwarmConsts.ClassProperty, typeof(MyJob).AssemblyQualifiedName },
                    { SwarmConsts.ShardingProperty, "1" },
                    { SwarmConsts.LoadProperty, "1" },
                    { SwarmConsts.ShardingParametersProperty, null },
                }
            };

            api.Create(job).Wait();
        }
Exemplo n.º 3
0
        static void CreateReflectionJob()
        {
            SwarmApi api = new SwarmApi("http://127.0.0.1:8000", "BBBBBBBB");
            var      job = new Job
            {
                Name               = "test2",
                Group              = "DEFAULT",
                RetryCount         = 1,
                Performer          = Performer.SignalR,
                Executor           = Executor.Reflection,
                Description        = "iam a test job",
                Load               = 0,
                Owner              = "tester",
                Sharding           = 1,
                ShardingParameters = null,
                Properties         = new Dictionary <string, string>
                {
                    { SwarmConts.CronProperty, "*/15 * * * * ?" },
                    { SwarmConts.ClassProperty, typeof(MyJob).AssemblyQualifiedName }
                }
            };

            api.Create(job).Wait();
        }