public TransformerExampleJob(string name) : base(name)
        {
            var link1 = new Link <Employee>("link1");
            var link2 = new Link <Employee>("link2");
            var link3 = new Link <Employee>("link3");

            var input = new RestInputStage <Employee>("input1", "http://dummy.restapiexample.com/api/v1/employees");

            input.LinkTo(link1);

            var stage = new TransformerStage <Employee>("transform");

            stage.LinkFrom(link1);
            stage.LinkTo(link2)
            .ForMember(s => s.Name, d => d.Name + " Transformed");
            stage.LinkTo(link3, employee => employee.Age < 20)
            .ForMember(s => s.Salary, d => 10m);

            var output1 = new ConsoleOutputStage("output1");

            output1.LinkFrom(link2);
            var output2 = new ConsoleOutputStage("output2");

            output2.LinkFrom(link3);

            AddStages(input, output1, output2, stage);
        }
        public FilterExampleJob(string name) : base(name)
        {
            var link1 = new Link <Employee>("link1");
            var link2 = new Link <Employee>("link2");

            var input = new RestInputStage <Employee>("input", "http://dummy.restapiexample.com/api/v1/employees");

            input.LinkTo(link1);

            var stage = new FilterStage <Employee>("filter", employee => employee.Salary > 2500000);

            stage.LinkFrom(link1);
            stage.LinkTo(link2);

            var output = new ConsoleOutputStage("output");

            output.LinkFrom(link2);

            AddStages(input, output, stage);
        }
示例#3
0
        public RemoveDuplicatesExampleJob(string name) : base(name)
        {
            var link1 = new Link <Employee>("link1");
            var link2 = new Link <Employee>("link2");

            var input = new RestInputStage <Employee>("input1", "http://dummy.restapiexample.com/api/v1/employees");

            input.LinkTo(link1);

            var stage = new RemoveDuplicatesStage <Employee>("removeDuplicates")
                        .WithKey(s => s.Name);

            stage.LinkFrom(link1);
            stage.LinkTo(link2);

            var output = new ConsoleOutputStage("output");

            output.LinkFrom(link2);

            AddStages(input, output, stage);
        }
示例#4
0
        public SortExampleJob(string name) : base(name)
        {
            var link1 = new Link <Employee>("link1");
            var link2 = new Link <Employee>("link2");

            var input = new RestInputStage <Employee>("input1", "http://dummy.restapiexample.com/api/v1/employees");

            input.LinkTo(link1);

            var sort = new SortStage <Employee>("sort")
                       .WithKey(s => s.Name, SortDirection.Ascending)
                       .WithKey(s => s.Age, SortDirection.Descending);

            sort.LinkFrom(link1);
            sort.LinkTo(link2);

            var output = new ConsoleOutputStage("output");

            output.LinkFrom(link2);

            AddStages(output, input, sort);
        }