如何将XML文件传递到JMS队列 [英] How to pass XML file to JMS queue

查看:196
本文介绍了如何将XML文件传递到JMS队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有.xml个文件,我想将内容发送到JMS队列.在这种情况下,我应该将此xml转换为textmessage并发送吗?还是有一种方法可以直接发送xml.

I have .xml files and I want to send the content to the JMS queue. In this should I convert this xml to textmessage and send? or is there a way that we can directly send the xml.

我还想知道是否可以将对象(例如:MyClass.java的对象)发送到JMS队列?

And also I'd like to know is it possible to send objects (ex: objects of MyClass.java) to the JMS queue?

请有人指导我.

推荐答案

您可以使用TextMessage发送XML.但是由于XML已经存储在文件中,所以我将探讨使用BytesMessage仅发送原始字节内容的可能性.如果您是第一种选择,请在重新输入文件内容时小心使用正确的编码.

You can use the TextMessage to send XML. But since the XML is already stored in files, I would look at the possibility to send just the raw byte content, using a BytesMessage. If you go for first alternative, be careful about using correct encoding when redin the file content.

只要Java对象可序列化,它们就可以明确地作为JMS消息发送.

Java objects can definitively be sent as JMS messages, as long as they ar serializable.

这篇关于如何将XML文件传递到JMS队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆