How do we get a Spring Cloud Sleuth BaggageField in Spring IntegrationFlow working? Need help with adding it in the IntegrationFlow DSL
Added it in a transform(), however it is not being reflected.
spring.sleuth.baggage.local-fields: customField
spring.sleuth.baggage.correlation-fields: customField
@Bean
public BaggageField customField() {
return BaggageField.create("customField");
}
@Bean
public ScopeDecorator mdcScopeDecorator() {
// @formatter:off
return MDCScopeDecorator.newBuilder()
.clear()
.add(SingleCorrelationField.newBuilder(customField())
.flushOnUpdate()
.build())
.build();
// @formatter:on
}
return IntegrationFlows.from(jdbcMessageSource(), p -> p.poller(pollerSpec()))
.transform(message -> {
customField.updateValue("ARE");
return message;
}).split()
.channel(c -> c.executor(Executors.newCachedThreadPool()))
.transform(transformer, "transform")
.enrichHeaders(headerEnricherSpec -> headerEnricherSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))
.handle(Http.outboundGateway(url)
.httpMethod(HttpMethod.POST)
.expectedResponseType(String.class)
.requestFactory(requestFactory))
.channel(httpOutputChannel())
.get();
}