【发布时间】:2016-04-03 06:53:40
【问题描述】:
我正在使用 IBM MQ 并在 queue 上发送消息时,我需要捕获错误代码,例如:
MQJE001: Completion Code '2' Reason '2035'
我的问题是读取这个错误代码,我的 java 程序通过以下方式读取输出:
BufferReader reader = new BufferReader(new InputStreamReader(processSH.getInputStream())); // processSH - the process that is putting message on queue
如果没有错误代码,我可以通过这种方式读取输出,但无法使用:
String line = null;
while(line.reader.readLine()) != null){
system.out.println(line) // prints nothing in case of error
}
感谢所有帮助者!
【问题讨论】:
-
您使用哪个 MQ API 来放置消息?我认为您没有为 Java 使用正确的 MQ 类,因为该 API 会抛出包含 RC 的 MQExceptions。