如何将文件而不仅仅是文本发送到JMS队列?

时间:2016-01-05 18:06:17

标签: java jms

我刚刚下载并安装了WebSphere MQ 8.x(在我的Windows 7中)。现在我想学习如何发送和接收文件

WebSphere MQ安装附带一些代码示例(C:\Program Files\IBM\WebSphere MQ\Tools\jms\sample\JmsProducer.java),但所有这些代码示例(在/Tools目录中)都将消息用作String(用于发送和接收) )。

我想向/从JMS队列发送和接收文件。

更新:

我开始使用它:

BytesMessage bytes = session.createBytesMessage();
String codePage = CCSID.getCodepage(((MQDestination) destination)
           .getIntProperty(WMQConstants.WMQ_CCSID));
bytes.writeBytes("In the destination code page".getBytes(codePage));
producer.send(bytes);

但是我收到了这个错误: 对于MQDestination类型

,方法getIntProperty(String)未定义

1 个答案:

答案 0 :(得分:0)

你能否告诉我们你在哪里?#34;目的地" ?铸造到" MQDestination"似乎表明它不是JMS" Destination"的一个实例。类 看来你正在混合使用JMS和MQ专有类/范例