如何使用HA配置连接IBM MQ管理器?

5

我正在编写一个使用amqmdnet.dll连接到IBM Websphere MQ Manager的C#客户端,使用以下结构:

_myQueueManager = new MQQueueManager(queueManagerName, properties);

在属性哈希表中,我正在设置主机名、通道和队列管理器。现在,如何在我的客户端应用程序中实现自动重新连接功能?我们有IBM MQ多实例队列管理器HA配置。
基本上,如果我的客户端连接失败,我必须回退到四个终端点。
1个回答

6
根据文档,以下是相关的IT技术内容:

You can supply a list of hostnames and ports as an argument to the constructor MQQueueManager (String queueManagerName, Hashtable properties) using CONNECTION_NAME_PROPERTY.

For example:

ConnectionName = "fred.mq.com(2344),nick.mq.com(3746),tom.mq.com(4288)";
Hashtable Properties-new Hashtable();
properties.Add(MQC.CONNECTION_NAME_PROPERTY,ConnectionName);
MQQueueManager qmgr=new MQQueue Manager("qmgrname",properties);

When a connection attempt is made, the connection name list is processed in order. If the connection attempt to the first host name and port fails, then connection to the second pair of attributes is attempted. The client repeats this process until either a successful connection is made or the list is exhausted. If the list is exhausted, an appropriate reason code and completion code is returned to the client application.

一定要遵循在.NET中自动重新连接客户端中的建议,以确保选项在托管/非托管模式方面正确指定。


谢谢Rob。这正是我在寻找的。我还在示例中找到了相同的内容:SimpleClientAutoReconnectGet。对于其他可能感兴趣的人,IBM样例可以在安装目录下找到:C:\Program Files (x86)\IBM\WebSphere MQ\Tools\dotnet\samples\cs - PushCode
2
有没有Java的相同设置的链接? - atul tripathi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接