[英]Setting Timeout on Close and Disconnect IBM MQ.NET Client
Is it possible to set timeout period for the code below: 是否可以为以下代码设置超时期限:
private MQQueueManager queueManager;
private MQQueue queue;
...
queue.Close();
queueManager.Disconnect();
The reason is that sometimes the connection get stuck trying to close. 原因是有时尝试关闭连接时会卡住。 The thread blocked on Close() or Disconnect().
线程在Close()或Disconnect()上阻塞。
Update 更新
The client uses managed client, CCDT file, cluster queue manager and other features that might result in different settings. 客户端使用托管客户端,CCDT文件,群集队列管理器和其他功能可能导致不同的设置。
Please provide code sample. 请提供代码示例。
Can we change the timeout setting using similar method via APIs like below: 我们可以通过类似的API使用类似的方法来更改超时设置吗,如下所示:
int openOptions = Set possible settings here
var properties = new Hashtable
{
Set possible settings here
};
_queueManager = new MQQueueManager(_queueManagerName, properties);
_queue = _queueManager.AccessQueue(QUEUE_NAME, openOptions);
The way the MQ client and MQ server decide to TIMEOUT a connection is based on the negotiated Heart Beat ( HBINT
) value for the running SVRCONN
channel. MQ客户端和MQ服务器决定连接超时的方式基于正在运行的
SVRCONN
通道的协商的心跳( HBINT
)值。 The negotiated HBINT
is always the highest value negotiated between the SVRCONN
and the client application. 协商的
HBINT
始终是SVRCONN
与客户端应用程序之间协商的最高值。
Note: SVRCONN
HBINT
has a default value of 300
. 注意:
SVRCONN
HBINT
的默认值为300
。
The TIMEOUT is determined in one of two ways: 超时是通过以下两种方法之一确定的:
HBINT
is less than 60 the TIMEOUT is 2x HBINT
. HBINT
小于60,则TIMEOUT是2x HBINT
。 HBINT
is greater than or equal to 60 the TIMEOUT is HBINT
+ 60. HBINT
大于或等于60,则TIMEOUT为HBINT
+ 60。 Specific to the area of .NET clients related to HBINT
: 特定于与
HBINT
相关的.NET客户端HBINT
:
APAR IT26614 corrects the following three issues: APAR IT26614纠正了以下三个问题:
In either Unmanaged or Managed mode it is documented that if you are not using a CCDT the HBINT
will use the value of the SVRCONN
channel. 在非托管或托管模式下,都有文件记录,如果您不使用CCDT,则
HBINT
将使用SVRCONN
通道的值。 In reality if not using a CCDT the HBINT
on the client side defaults to 300
so this is the lowest HBINT
you will see. 实际上,如果不使用CCDT,则客户端的
HBINT
默认为300
因此这是您将看到的最低的HBINT
。
Specific to Managed .NET the client side HBINT
cannot be lower than the SVRCONN
HBINT
the connection will fail with a 2059. This problem impacts both with or without CCDT. 特定于托管.NET的客户端
HBINT
不能低于SVRCONN
HBINT
,连接将失败并显示HBINT
无论是否使用CCDT,此问题都会影响。
CLNTCONN
HBINT
to a value less than the SVRCONN
HBINT
CLNTCONN
HBINT
设置为小于SVRCONN
HBINT
的值 SVRCONN
HBINT
is set to 301
or higher SVRCONN
HBINT
设置为301
或更高 Specific to Managed .NET the client side receive timeout was being calculated in milliseconds not seconds. 特定于Managed .NET,客户端接收超时的计算以毫秒为单位,而不是秒。 In this case the defect has been present according to IBM for a long time, but did not present itself until APAR IT16167: Managed .NET client application does not send heartbeat request to queue manager was introduced in 8.0.0.10 and 9.0.0.4 (IBM also confirmed this is present in GA 9.1.0.0).
在这种情况下,根据IBM长期存在该缺陷,但直到APAR IT16167才发现该缺陷:在8.0.0.10和9.0.0.4中引入了托管的.NET客户端应用程序不向队列管理器发送心跳请求 (IBM还确认GA 9.1.0.0中存在此内容)。 The reason it was not previously a problem was that Managed .NET was never initiating the Heart Beat, the queue manager would always send the Heart Beat at HBINT + 5 seconds and the .NET client would respond.
以前不是问题的原因是Managed .NET从未启动过心跳,队列管理器总是在HBINT + 5秒时发送心跳,.NET客户端会响应。 Once this was corrected, the miscalculation of the receive timeout presented itself.
一旦更正了该错误,就会出现接收超时的错误计算。
The fix is targeted for delivery in the following PTFs: Version Maintenance Level v8.0 8.0.0.13 v9.0 LTS 9.0.0.7 v9.1 CD 9.1.3 v9.1 LTS 9.1.0.3
As of July 12th 2019 only 9.0.0.7 and 9.1.3 have been released and can be downloaded from the following locations: 截至2019年7月12日,仅9.0.0.7和9.1.3已发布,可以从以下位置下载:
Unless you are using a version of the amqmdnet.dll
which includes the above APAR or you ask IBM to provide you with a IFIX for any lower version, the only way to accomplish a lower than 300 HBINT would require the SVRCONN
HBINT
to be set to a lower value in combination with the client using a CCDT with the CLNTCONN
HBINT
set to a lower value. 除非您使用包含上述APAR的
amqmdnet.dll
版本,或者您要求IBM为任何较低版本提供IFIX,否则,实现低于300 HBINT的唯一方法是将SVRCONN
HBINT
设置为结合使用使用CCDT并将CLNTCONN
HBINT
设置为较低值的客户端的较低值。 Based on unmanaged or Managed .NET you have two options: 基于非托管或托管.NET,您有两个选择:
CLNTCONN
HBINT
to 1
and allow the client to to always negotiate up to the SVRCONN
HBINT
value. CLNTCONN
HBINT
设置为1
并允许客户端始终协商最高SVRCONN
HBINT
值。 You would then need the MQ admin to set the SVRCONN
HBINT
to the desired value. SVRCONN
HBINT
设置为所需的值。 SVRCONN
HBINT
to the desired value, and you would then need to set the CCDT CLNTCONN
HBINT
to the same value as the SVRCONN
HBINT
. SVRCONN
HBINT
设置为所需的值,然后需要将CCDT CLNTCONN
HBINT
设置为与SVRCONN
HBINT
相同的值。 If you are using a version of the amqmdnet.dll
which includes the above APAR or you ask IBM to provide you with a IFIX for any lower version the following will be how things work: 如果您正在使用包含上述APAR的
amqmdnet.dll
版本,或者要求IBM为您提供任何较低版本的IFIX,则将以下列方式工作:
HBINT(1)
and will negotiate up to the SVRCONN
value. HBINT(1)
的等效项,并将协商直至SVRCONN
值。 CLNTCONN
can have the HBINT
set to 1
which would result in the same behavior as above when not using a CCDT, the HBINT
will negotiate up to the SVRCONN
value. CLNTCONN
可以将HBINT
设置为1
,这将导致不使用CCDT时具有与上述相同的行为, HBINT
将协商达到SVRCONN
值。 No matter if using a CCDT with CLNTCONN
HBINT
set to 1
or not using a CCDT where client side will use HBINT(1)
, you will need to ask the MQ admin to set the SVRCONN
HBINT
to a lower value to accomplish a shorter TIMEOUT. 无论是使用
CLNTCONN
HBINT
设置为1
的CCDT还是不使用客户端将使用HBINT(1)
的CCDT,您都需要让MQ管理员将SVRCONN
HBINT
设置为一个较小的值,以缩短超时时间。
Example of setting HBINT
on the CCDT CLNTCONN
channel: 在CCDT
CLNTCONN
通道上设置HBINT
示例:
DEFINE CHL(CLIENT_CHL) CHLTYPE(CLNTCONN) CONNAME('1.2.3.4(9999)') QMNAME(ABC) HBINT(1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.