Java DSL polishing around HeaderEnricherSpec

* Make `HeaderEnricherSpec extends ConsumerEndpointSpec` to avoid extra
EIP-method with two `Consumer`s, when only one for
the `HeaderEnricherSpec` can address all the options - header enricher,
as well as target endpoint
* Move `this.endpointFactoryBean.setHandler(this.handler)` into
the `ConsumerEndpointSpec#doGet()` instead of ctor to avoid
duplicate code from the target implementations (e.g. `BarrierSpec`)
This commit is contained in:
Artem Bilan
2017-03-21 16:32:01 -04:00
committed by Gary Russell
parent 515042fa03
commit 78bab07874
6 changed files with 47 additions and 58 deletions

View File

@@ -177,7 +177,7 @@ public class CorrelationHandlerTests {
return f -> f.enrichHeaders(s -> s.header("FOO", "BAR"))
.split("testSplitterData", "buildList", c -> c.applySequence(false))
.channel(MessageChannels.executor(taskExecutor()))
.split(Message.class, m -> m.getPayload(), c -> c.applySequence(false))
.split(Message.class, Message::getPayload, c -> c.applySequence(false))
.channel(MessageChannels.executor(taskExecutor()))
.split(s -> s
.applySequence(false)

View File

@@ -304,8 +304,9 @@ public class TransformerTests {
@Bean
public IntegrationFlow pojoTransformFlow() {
return f -> f
.enrichHeaders(h -> h.header("Foo", "Bar"),
e -> e.advice(idempotentReceiverInterceptor()))
.enrichHeaders(h -> h
.header("Foo", "Bar")
.advice(idempotentReceiverInterceptor()))
.transform(new PojoTransformer());
}