spring-integration - 处理具有相同消息的连续 HTTP 调用
问题描述
我想一个接一个地进行两个顺序调用,但对两个调用使用相同的请求消息。但如我的示例代码所示,第一个 post 调用的响应默认成为第二个调用的请求。spring 集成中这种模式最优雅的解决方案是什么
public IntegrationFlow test() {
return IntegrationFlows
.from("testChannel")
.handle(httpConfigurations.postCall1())
.handle(httpConfigurations.postCall2())
.get();
}
解决方案
在第一次.handle
添加带有表达式的标题丰富器之前,将其复制payload
到标题中。
在第二次之前.handle
使用 a.transform()
将标头复制回有效负载。
推荐阅读
- spring - 如何从 TASKLET 中的执行方法获取 Spring Batch 作业实例 ID
- python - 用格式打印出sqlite数据库查询的结果
- python - 如何识别平面图的形状?
- javascript - 如何在ag网格(Angular)中设置默认选择的第一行
- php - 无法加载 JSON 数据并显示到 PHP
- javascript - 首次加载谷歌图表时未出现垂直轴标签
- reactjs - 无法将 createdAt 和 updatedAt 保存为日期时间值,也无法将后端保存为前端
- mysql - Mysql where 子句精确匹配返回不精确 - "sàvko" = "savko"
- ember.js - 使用带有子路由“transitionTo”的 emberjs 查询参数?
- android - Phonegap APK - jarsigner -verify 引发错误 - res/layout/notification_action.xml 的 SHA-256 签名文件摘要无效