简体   繁体   English

如何发送文件而不只是文本到JMS队列中?

[英]How to send files instead of just text into JMS queue?

I just downloaded and installed WebSphere MQ 8.x (in my Windows 7). 我刚刚下载并安装了WebSphere MQ 8.x(在Windows 7中)。 Now I want to learn how to send and receive files . 现在,我想学习如何发送和接收文件

The WebSphere MQ installation comes with some code samples ( C:\\Program Files\\IBM\\WebSphere MQ\\Tools\\jms\\sample\\JmsProducer.java ), but all them (in the /Tools directory) use message(s) as a String (to send and receive). WebSphere MQ安装附带了一些代码示例( C:\\Program Files\\IBM\\WebSphere MQ\\Tools\\jms\\sample\\JmsProducer.java ),但是所有这些代码C:\\Program Files\\IBM\\WebSphere MQ\\Tools\\jms\\sample\\JmsProducer.java (在/Tools目录中)都使用消息作为String (发送和接收)。

I would like to send and receive files to/from a JMS queue. 我想向/从JMS队列发送和接收文件。

UPDATE: 更新:

I started using this : 我开始使用这个:

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);

but I got this error : The method getIntProperty(String) is undefined for the type MQDestination 但是我遇到了这个错误:方法MQDestination的getIntProperty(String)未定义

Could you show us the code where you inatanciate "destination" ? 您能告诉我们您不知道“目的地”的代码吗? the casting to "MQDestination" seems to indicate it is not an instance of JMS "Destination" class It seems you are mixing JMS and MQ proprietary classes/paradigm 强制转换为“ MQDestination”似乎表明它不是JMS“ Destination”类的实例。似乎您正在混合JMS和MQ专有类/范例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM