IBM MQ消息侦听器 [英] IBM MQ Message Listener

查看:1597
本文介绍了IBM MQ消息侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否有人知道如何使用IBM MQ创建消息监听器?我知道如何使用JMS规范来完成它,但我不知道如何为IBM MQ做到这一点。非常感谢任何链接或指针。

Hi does anyone know how to create a message listener using IBM MQ? I know how to do it using the JMS spec but I am not sure how to do it for IBM MQ. Any links or pointers are greatly appreciated.

推荐答案

虽然前面的响应者有一个WMQ Java API,但WMQ也支持JMS,所以这里有一些资源让你开始吧。

Although there is a WMQ Java API as noted by the previous responders, WMQ supports JMS as well so here are some resources to get you started there.

看一下这篇文章: IBM WebSphere开发者技术期刊:在WebSphere MQ V6.0上运行独立的Java应用程序

此外,如果你已经安装了完整的WMQ客户端而不只是抓住了罐子,那么你将安装大量的示例代码。默认情况下,它们将存在于C:\Program Files \IBM \WebSphere MQ \ tools \ _jms或/ opt / mqm / samp中,具体取决于您的平台。

Also, if you have installed the full WMQ client and not just grabbed the jars then you will have lots of sample code installed. By default, these will live in C:\Program Files\IBM\WebSphere MQ\tools\jms or /opt/mqm/samp depending on your platform.

如果您需要WMQ客户端安装媒体,请获取这里。请注意,这是WMQ v7客户端,而不是v6客户端。它与v6 QMgr兼容,但由于v6是截至2011年9月的寿命终止,你应该在v7客户端上进行新的开发,如果可能的话,还应该使用v7 QMgr。如果双方都是v7,那么可以提供很多功能和性能增强。

If you need the WMQ Client install media, get it here. Note that this is the WMQ v7 client and not the v6 client. It is compatible with the v6 QMgr but since v6 is end-of-life as of September 2011 you should be doing new development on the v7 client and, if possible, a v7 QMgr. There are a lot of functional and performance enhancements available if both sides are v7.

您可以获得产品手册此处如果您需要它。

You can get the product manual here if you need it.

最后,请确保在获得JMS异常时打印链接的异常。这不是WMQ的事情,而是JMS的事情。 Sun为JMS异常提供了一个多级数据结构,而真正有趣的部分通常是嵌套级别。这不是什么大问题,可以用几行来实现:

Finally, please be sure when you get a JMS exception to print the linked exception. This is not a WMQ thing, rather it's a JMS thing. Sun provided a multi-level data structure for JMS exceptions and the really interesting parts are often in the nested level. This is not a big deal and can be implemented in a few lines:

try {
  .
  . code that might throw a JMSException
  .
} catch (JMSException je) {
  System.err.println("caught "+je);
  Exception e = je.getLinkedException();
  if (e != null) {
    System.err.println("linked exception: "+e);
  } else {
    System.err.println("No linked exception found.");
  }
}

这有助于确定JMS错误与之间的差异运输错误。例如,JMS安全性错误可能是WMQ 2035,或者它可能是JSSE配置,或者应用程序可能无法访问文件系统中的某些内容。其中只有一个值得花费大量时间来挖掘WMQ错误日志,并且只有通过打印链接的异常才能判断它是否是那个。

This helps to determine the difference between a JMS error versus a transport error. For example a JMS security error might be a WMQ 2035, or it might be the JSSE configuration, or the app might not have access to something in the file system. Only one of these is worth spending a lot of time digging through the WMQ error logs for and only by printing the linked exception will you be able to tell if it's that one.

这篇关于IBM MQ消息侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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