java - 使用 spring 集成从 wmq 获取 JMS 目标
问题描述
我正在使用消息驱动通道适配器 (Spring Integration) 使用来自 IBM Mq 的消息。消息中的 JMS Destination 属性为空。有人可以告诉我如何在标题中获取使用 wmq 消费的消息的队列名称。
JMS Destination 属性将用于从 apache Active mq 使用的消息,但不适用于 IBM MQ。
解决方案
有这样DefaultJmsHeaderMapper
的代码:
try {
Destination destination = jmsMessage.getJMSDestination();
if (destination != null) {
headers.put(JmsHeaders.DESTINATION, destination);
}
}
catch (Exception ex) {
this.logger.info("failed to read JMSDestination property, skipping", ex);
}
因此,如果 IBM Mq 不提供该属性值,我们真的不会有JmsHeaders.DESTINATION
关于此事的标题。
我建议您调查消费后获得的所有标头,看看哪些标头可能对您有要求的目的地。
否则,您始终可以在覆盖的方法中扩展DefaultJmsHeaderMapper
和实现自己的逻辑。toHeaders()
推荐阅读
- node.js - 如何使用 webpack 在不同项目中使用一个文件夹中的字体?
- python - XML ParseError:文档元素后的垃圾:自定义验证器(Wagtail)中的第 1 行第 11 列
- angular - 我想从 URL 中隐藏查询参数。我怎样才能达到同样的效果?
- unity3d - 使用 mrtk v2 RC1 构建统一项目的问题
- android - 如何从 google fit 响应中获取重量单位
- c# - 如何使用 GraphQL.Net 和 c# 将集合传递给 GraphQL 突变?
- python - 如何在unittest的设置函数中将字典作为参数传递
- tensorflow - Keras 自定义指标回调:如何访问 val_data?
- testing - “无法打开 perl 脚本“t/spec/fudgeall”:找不到文件或目录”
- javascript - 如何通过滚动使元素切换或跟随中心?