Skip to content

Commit cc113e1

Browse files
committed
Fix IntegrationFlowAdapter sample in docs
Java DSL has been improved since the last time this sample has been added into docs
1 parent c9023d1 commit cc113e1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/reference/asciidoc/dsl.adoc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,50 +1074,50 @@ public class MyFlowAdapter extends IntegrationFlowAdapter {
10741074
10751075
private final AtomicBoolean invoked = new AtomicBoolean();
10761076
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();
10791079
}
10801080
10811081
@Override
10821082
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"));
10921092
}
10931093
10941094
public String messageSource() {
1095-
return "T,H,I,N,G,2";
1095+
return "T,H,I,N,G,2";
10961096
}
10971097
10981098
@Splitter
10991099
public String[] split(String payload) {
1100-
return StringUtils.commaDelimitedListToStringArray(payload);
1100+
return StringUtils.commaDelimitedListToStringArray(payload);
11011101
}
11021102
11031103
@Transformer
11041104
public String transform(String payload) {
1105-
return payload.toLowerCase();
1105+
return payload.toLowerCase();
11061106
}
11071107
11081108
@Aggregator
11091109
public String aggregate(List<String> payloads) {
1110-
return payloads.stream().collect(Collectors.joining());
1110+
return payloads.stream().collect(Collectors.joining());
11111111
}
11121112
11131113
@Filter
11141114
public boolean filter(@Header Optional<String> thing1) {
1115-
return thing1.isPresent();
1115+
return thing1.isPresent();
11161116
}
11171117
11181118
@ServiceActivator
11191119
public String handle(String payload, @Header String thing1) {
1120-
return payload + ":" + thing1;
1120+
return payload + ":" + thing1;
11211121
}
11221122
11231123
}

0 commit comments

Comments
 (0)