为什么没有根据成功建议复制原始标题。使用 http 出站适配器发送消息后,我希望收到原始消息头,但没有收到。只能访问 originalMessagePayload。如果我不使用建议并且在网关适配器调用我的 post 处理程序之后,我会看到所有标题。不可能添加带有建议的标题吗?
@Configuration
public class MyIntegrationConfiguration {
@Bean
HttpRequestExecutingMessageHandler MyFileNotificationEndpoint(@Value("${uri}") String uri) throws URISyntaxException {
URI uri = UriComponentsBuilder.newInstance()
.uri(new URI(uri))
.path("/api2/integration/myFileNotification")
.build().toUri();
return Http
.outboundGateway(uri)
// .outboundChannelAdapter(uri)
.httpMethod(HttpMethod.POST)
.get();
}
@Bean
public IntegrationFlow sendNotifyOnTypingNotification(TypingNotificationToIncomeFileRqTransformer toIncomeFileRqTransformer,
HttpRequestExecutingMessageHandler myFileNotificationEndpoint) {
return f -> f
.transform(toIncomeFileRqTransformer)
.enrichHeaders(Collections.singletonMap("Content-Type", APPLICATION_JSON_VALUE))
.handle(myFileNotificationEndpoint, c -> c.advice(myNotificationEndpointAdvice()))
.log();
}
@Bean
public Advice myNotificationEndpointAdvice() {
ExpressionEvaluatingRequestHandlerAdvice advice = new
ExpressionEvaluatingRequestHandlerAdvice();
advice.setSuccessChannelName("addRecognitionStatusOnSuccessSend.input");
advice.setTrapException(true);
return advice;
}
@Bean
public IntegrationFlow addRecognitionStatusOnSuccessSend() {
return f -> f
.enrichHeaders(Collections.singletonMap("addStatus", RECOGNITION_STATUS_MOVED))
.handle("documentImageService", "addRecognition");
}
}