本文介绍了WebSphere MQ的异步放不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须使用WebSphere MQ v.7.0.1的应用程序。服务器是Linux,客户端应用程序运行在Windows 7并使用MQ类for Java是用Java编写的。一种在客户端和服务器之间的队列是专为客户端和服务器之间的保活协议。为各种我们并不需要进入的原因,这是必要的,以保持对真正的后端其中的MQ服务器只是一部分连接。

We have an application using Websphere MQ v.7.0.1. The server is on linux, the client application runs on Windows 7 and is written in Java using the MQ classes for java. One of the queues between the client and the server is exclusively for a keepalive protocol between the client and the server. For a variety of reasons we don't need to go into, this is necessary to maintain connections to the "real back end" of which the MQ server is only a part.

为存活协议,能够合理地发挥除了在实例时,其中一台服务器出现故障和客户需要时,它可用来重新连接。然后我们有问题。

The Keepalive protocol works reasonably well except in the instance when one of the servers goes down and the clients need to reconnect to it when it becomes available. Then we have problems.

我们已经决定,我们的保活协议的实现来说太复杂。客户只需要在固定时间间隔发送这些保持活动消息发送到服务器,如果他们到达服务器或不必不关心。如果他们不这样做,服务器将结果
适当的行动。

We have decided that our implementation of the keepalive protocol is much too complicated. The client only needs to send these keepalive messages to the server at a regular interval and need not care if they reach the server or not. If they don't, the server will take
appropriate action.

因此​​,一个异步暗示看跌本身。我们在实现它的第一次尝试如下:

Therefore, an asynchronous put suggests itself. Our first attempt at implementing it was as follows:

从这个:

MQPutMessageOptions pmo = new MQPutMessageOptions();  // accept the defaults
QueueKL.put(mqMessage,pmo);                                             

这样:

MQPutMessageOptions pmo = new MQPutMessageOptions();                    
pmo.options |= CMQC.MQPMO_ASYNC_RESPONSE;                               
QueueKL.put(mqMessage,pmo); 

结果是一个令人不快的意外。而是立即返回的,认沽调用永远不会返回,并从它被称为永不线程显示生命的又一个迹象。

The results were an unpleasant surprise. Instead of returning immediately, the put call never returns and the thread from which it was called never shows another sign of life.

当然,这个调用在try-catch块推出,我们试图抓住作为最后手段,任何可能的Throwable可能即抛出捕获(的Throwable T)并记录它。那种没有被记录。线程似乎在这一点上受阻,我期望的完全相反的情况发生。

Of course this call is launched in a try-catch block and we've tried to catch as a last resort any possible Throwable that could be thrown i.e. catch (Throwable t) and log it. Nothing of the sort is logged. The thread appears to be blocked there at this point, the exact opposite of what I expected to happen.

我必须失去了一些东西至关重要我是如何执行这一结果
调用,(在队列或需要的QueueManager一些特殊的设置吗?IBM的文档是aggravatingly稀疏这里),但我不知道那是什么。请帮我到这条底线。

I must be missing something critical in how I am implementing this
call, (is some special setup required in the Queue or QueueManager? The IBM docs are aggravatingly sparse here) but I don't know what that is. Please help me get to the bottom of this.

推荐答案

这是否帮助?你在7.0.1.8任何不吉利的机会呢?

Does this help? Are you at 7.0.1.8 by any unlucky chance?

这个问题也影响到的WebSphere MQ类的用户提供
Java的谁是把消息发送到WebSphere MQ队列
在放置消息选项指定MQPMO_ASYNC_RESPONSE
(MQPMO)结构。

"This issue also affects users of the WebSphere MQ classes forJava who are putting messages to a WebSphere MQ queuespecifying MQPMO_ASYNC_RESPONSE in the PUT Message Options(MQPMO) structure."

尽量保证客户端是7.0.1.9 7.1.0.2或以上。

Try ensuring the client side is at 7.0.1.9 or 7.1.0.2 or higher

这篇关于WebSphere MQ的异步放不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 20:37