1616@ EnableIntegration
1717@ IntegrationComponentScan
1818public class SeparateFlowsExample {
19-
2019 @ MessagingGateway
21- public interface I {
22-
20+ public interface NumbersClassifier {
2321 @ Gateway (requestChannel = "multipleof3Flow.input" )
2422 void multipleof3 (Collection <Integer > is );
2523
2624 @ Gateway (requestChannel = "remainderIs1Flow.input" )
2725 void remainderIs1 (Collection <Integer > is );
2826
2927 @ Gateway (requestChannel = "remainderIs2Flow.input" )
30- void remainderIs2 (Collection <Integer > is );
31-
28+ void remainderIs2 (Collection <Integer > numbers );
3229 }
3330
3431 @ Bean
@@ -51,49 +48,36 @@ public IntegrationFlow multipleof3Flow() {
5148 return f -> f .split ()
5249 .<Integer > filter (p -> p % 3 == 0 )
5350 .channel ("multipleof3Channel" );
54-
5551 }
5652
5753 @ Bean
5854 public IntegrationFlow remainderIs1Flow () {
5955 return f -> f .split ()
6056 .<Integer > filter (p -> p % 3 == 1 )
6157 .channel ("remainderIs1Channel" );
62-
6358 }
6459
6560 @ Bean
6661 public IntegrationFlow remainderIs2Flow () {
6762 return f -> f .split ()
6863 .<Integer > filter (p -> p % 3 == 2 )
6964 .channel ("remainderIs2Channel" );
70-
7165 }
7266
7367 public static void main (String [] args ) {
74-
7568 final ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext (SeparateFlowsExample .class );
76-
7769 DirectChannel multipleof3Channel = ctx .getBean ("multipleof3Channel" , DirectChannel .class );
7870 multipleof3Channel .subscribe (x -> System .out .println ("multipleof3Channel: " + x ));
79-
8071 DirectChannel remainderIs1Channel = ctx .getBean ("remainderIs1Channel" , DirectChannel .class );
8172 remainderIs1Channel .subscribe (x -> System .out .println ("remainderIs1Channel: " + x ));
82-
8373 DirectChannel remainderIs2Channel = ctx .getBean ("remainderIs2Channel" , DirectChannel .class );
8474 remainderIs2Channel .subscribe (x -> System .out .println ("remainderIs2Channel: " + x ));
85-
86- ctx .getBean (I .class )
75+ ctx .getBean (NumbersClassifier .class )
8776 .multipleof3 (Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 ));
88-
89- ctx .getBean (I .class )
77+ ctx .getBean (NumbersClassifier .class )
9078 .remainderIs1 (Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 ));
91-
92- ctx .getBean (I .class )
79+ ctx .getBean (NumbersClassifier .class )
9380 .remainderIs2 (Arrays .asList (1 , 2 , 3 , 4 , 5 , 6 ));
94-
9581 ctx .close ();
96-
9782 }
98-
99- }
83+ }
0 commit comments