从 .NET 应用程序将 Websphere MQ 与 JMS 结合使用
我正在尝试通过使用 JMS 作为传输协议的 Websphere MQ 向 java 服务器发送消息。我可以愉快地使用 IBM 提供的库将消息放到 MQ 上,但服务器拒绝它们。我假设(希望正确)这是因为我缺少 MQ 消息上的各种 JMS 特定标头/属性。
我通过检查队列确保消息的有效负载相同(如果有帮助的话,它们都是映射消息),但不想完全实现 JMS Websphere MQ 协议只是为了让它工作。
我想知道是否有人设法让它工作,如果是的话,您需要在 JMS 标头中指定的最少信息量是多少?有没有其他方法可以直接在 MQ 上执行此操作(我见过一些关于使用 java interop 的内容,但我认为这有点过分了)。
任何帮助将不胜感激!
I'm trying to send a message to a java server over a Websphere MQ which uses JMS as the transport protocol. I can happily drop messages on the MQ using the IBM supplied libraries, but the server rejects them. I'm assuming (hopefully correctly) that this is because I'm missing various JMS specific headers/properties on the MQ message.
I have ensured the payloads for the messages are the same by inspecting the queue (they are both map messages if that helps), but don't want to fully implement the JMS Websphere MQ protocol just to get this to work.
I'm wondering if anyone has managed to get this to work, and if so what's the minimum amount of information you need to specify in the JMS header? Are there any alternatives to doing this directly on the MQ (I've seen some about using java interop, but this is something I think would be overkill).
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以粘贴您用来读取消息的 Java 代码吗?该代码是否假设该消息是“MapMessage”。通常,从非 Java 客户端放入队列的内容将显示为 TextMessage 或 BytesMessage。
只要您以 TextMessage / BytesMessage 的形式读取,WebsphereMQ JMS api 通常就可以读取那些没有 JMS 标头的消息。
在我的服务器代码中,我的内容通常作为字节放入队列,因此显示为 BytesMessage,但以防万一我收到手动放入队列的消息,我捕获 classcastException,并测试是否它实际上是一条 TextMessage。
Can you paste the Java code you are using to read the message. Is that code assuming that the message is a "MapMessage". Normally something put into a Queue from a non-java client will appear as either a TextMessage or a BytesMessage.
The WebsphereMQ JMS api is normally fine with reading those messages without the JMS headers as long as you read as a TextMessage / BytesMessage as put.
In my server code, my content is normally put to the queue as bytes, and so appears as a BytesMessage, but just in case i get a message that was manually put on the queue, i catch the classcastexception, and test to see if it is in fact a TextMessage.
您是否尝试使用 MQI 发送 JMS 消息?查看 IBM 的 XMS 库。他们会提供您需要的一切。这些库提供了与 WebsphereMQ 配合使用的 JMS 的 .NET 实现。在过去的一年里,我多次使用这些库,在 java 和 .net 系统之间进行交流,并且对其功能非常满意。
XMS .NET 库下载
Are you trying to use MQI to send JMS messages? Take a look at the XMS libraries from IBM. They will provide everything that you need. The libraries provide a .NET implementation of JMS that works with WebsphereMQ. I have used these libs many times over the past year, talking between java and .net systems, and have been very happy with the functionality.
XMS .NET Library Download
WebSphere MQ 没有非常明确的错误消息。我建议在出现问题时检查的内容是:
WebSphere MQ doesn't have very clear error messages. The things I suggest to check when something went wrong are:
我想我也遇到了同样的问题,但我无法让 XMS 工作。如果您仍然遇到问题,这可能会有所帮助
问候克里斯托弗
I think I had the same problem and I couldn't get XMS to work. In case it's still a problem to you, this might help
Regards Kristoffer