我要求如果向1 MQ发送消息失败,则应将消息发送到第2个MQ。
我正在使用IBM websphere app server v 7.0.0.25
以下是相关的java代码
methodToSendtoMQ1()
{
try
{
firstQueueManager = new MQQueueManager(MANAGERFOR1);
//send to Qmanager1
}
catch (MQException mqEx)
{
retryUsing2ndManager();
}
}
retryUsing2ndManager()
{
try
{
secondQueueManager = new MQQueueManager(MANAGERFOR2); //Code is failing here
queue = secondQueueManager.accessQueue(someOutputQueue, MQC.MQOO_OUTPUT,null,null,null);
queue.put(responseMessage);
queue.close();
}
catch (MQException mqEx)
{
//Here the mqEx value is populated with an exception
}
}
代码失败,但有以下异常:
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to host 'HOSTFOR1(1234)' rejected.
[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9205: The host name supplied is not valid.
[3=HOSTFOR1,4=TCP]],3=HOSTFOR1(1234),5=RemoteTCPConnection.resolveHostname]
以下是主持人,频道等的条目。
HOST1=HOSTFOR1
CHANNEL1=CHANNELFOR1
MQMANAGER1=MANAGERFOR1
PORT1=1234
QNAME1=QNAMEFOR1
HOST2=HOSTFOR1
CHANNEL2=CHANNELFOR1
MQMANAGER2=MANAGERFOR2
PORT2=5678
QNAME2=QNAMEFOR1