@@ -1074,50 +1074,50 @@ public class MyFlowAdapter extends IntegrationFlowAdapter {
1074
1074
1075
1075
private final AtomicBoolean invoked = new AtomicBoolean();
1076
1076
1077
- public Date nextExecutionTime(TriggerContext triggerContext) {
1078
- return this.invoked.getAndSet(true) ? null : new Date ();
1077
+ public Instant nextExecutionTime(TriggerContext triggerContext) {
1078
+ return this.invoked.getAndSet(true) ? null : Instant.now ();
1079
1079
}
1080
1080
1081
1081
@Override
1082
1082
protected IntegrationFlowDefinition<?> buildFlow() {
1083
- return from (this::messageSource,
1084
- e -> e.poller(p -> p.trigger(this::nextExecutionTime)))
1085
- .split(this)
1086
- .transform(this)
1087
- .aggregate(a -> a.processor( this, null), null )
1088
- .enrichHeaders(Collections.singletonMap("thing1", "THING1"))
1089
- .filter(this)
1090
- .handle(this)
1091
- .channel(c -> c.queue("myFlowAdapterOutput"));
1083
+ return fromSupplier (this::messageSource,
1084
+ e -> e.poller(p -> p.trigger(this::nextExecutionTime)))
1085
+ .split(this)
1086
+ .transform(this)
1087
+ .aggregate(this)
1088
+ .enrichHeaders(Collections.singletonMap("thing1", "THING1"))
1089
+ .filter(this)
1090
+ .handle(this)
1091
+ .channel(c -> c.queue("myFlowAdapterOutput"));
1092
1092
}
1093
1093
1094
1094
public String messageSource() {
1095
- return "T,H,I,N,G,2";
1095
+ return "T,H,I,N,G,2";
1096
1096
}
1097
1097
1098
1098
@Splitter
1099
1099
public String[] split(String payload) {
1100
- return StringUtils.commaDelimitedListToStringArray(payload);
1100
+ return StringUtils.commaDelimitedListToStringArray(payload);
1101
1101
}
1102
1102
1103
1103
@Transformer
1104
1104
public String transform(String payload) {
1105
- return payload.toLowerCase();
1105
+ return payload.toLowerCase();
1106
1106
}
1107
1107
1108
1108
@Aggregator
1109
1109
public String aggregate(List<String> payloads) {
1110
- return payloads.stream().collect(Collectors.joining());
1110
+ return payloads.stream().collect(Collectors.joining());
1111
1111
}
1112
1112
1113
1113
@Filter
1114
1114
public boolean filter(@Header Optional<String> thing1) {
1115
- return thing1.isPresent();
1115
+ return thing1.isPresent();
1116
1116
}
1117
1117
1118
1118
@ServiceActivator
1119
1119
public String handle(String payload, @Header String thing1) {
1120
- return payload + ":" + thing1;
1120
+ return payload + ":" + thing1;
1121
1121
}
1122
1122
1123
1123
}
0 commit comments