java - 是否可以在路由器中的消息中添加标头?
问题描述
我有返回通道名称的路由器(如预期的那样):
public String route(Message<CustomEntity> msg) {
...
return "toAdd";
...
return "toUpd";
...
}
是否可以在路由器中为消息添加新标头?
解决方案
不,这不对。这不是改变消息的路由器责任。您需要HeaderEnricher
改用:https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-transformation-chapter.html#header-enricher
标头可以由 SpEL 填充或Function
在运行时针对请求消息填充。
推荐阅读
- c - Lexer 将标识符的一部分识别为关键字
- apache - 如何在 Centos 上使用 ansible 模块启动 httpd 服务
- amazon-web-services - 向另一台机器的 EC2 实例公开端口
- javascript - Express js 错误 404 页面用静态文件拦截
- php - Laravel,阿帕奇
- vba - 如何遍历子文件夹?
- vba - 检查数组中的数据是否存在于工作表中
- ios - 存折-带有刻度的 storeCard 设计
- python - `CDLL()` 如何找到要加载的文件,只有文件基名?
- sql - sql server 等效于 xmlelement 格式