在将JSON字符串消息发布到IBM MQ主题时,我遇到了这个随机问题。它总是随机发生。我不确定如何查明问题。自从我切换到SSL Channel后,就会发生这种情况。
我使用的IBM.XMS.dll版本是8.0.0.6。以下是代码段和异常详细信息:
static void Main(string[] args)
{
try
{
XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory();
Console.WriteLine("Connection Factory created.");
connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "MQ_TX_MGR");
connectionFactory.SetStringProperty(XMSC.WMQ_CONNECTION_NAME_LIST, "10.10.10.10(1414)");
connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, "CL.SVRCONN");
connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT);
connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, 3);
connectionFactory.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, "*SYSTEM");
connectionFactory.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, "MYCipherSpec");
mqConnection = connectionFactory.CreateConnection();
Console.WriteLine("Connection created.");
session = mqConnection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);
Console.WriteLine("Session created.");
IDestination destination = session.CreateTopic("topic://TOPIC/NAME"); // destinationName
Console.WriteLine("Destination created.");
// create producer
IMessageProducer producer = session.CreateProducer(destination);
IMessage outbound = null;
outbound = session.CreateTextMessage("Long JSON String");
producer.Send(outbound);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
Console.WriteLine("Program waiting for message:");
Console.ReadLine();
}
}
例外:
堆栈追踪:
在IBM.WMQ.MQFAP.NmqiConnect(String name, NmqiConnectOptions pNmqiConnectOpts,MQConnectOptions cno,Hconn parentHconn,Phconn pHconn,Int32& compCode,Int32&原因, ManagedHconn rcnHconn)
在IBM.WMQ.MQFAP.NmqiConnect(String pQMgrName,NmqiConnectOptions pNmqiConnectOpts,MQConnectOptions pConnectOpts,Hconn parentHconn,Phconn pHconn,Int32& pCompCode, INT32和放大器; pReason)
在 IBM.XMS.Client.WMQ.WmqSession..ctor(WmqConnection连接, AcknowledgeMode ackMode,XmsPropertyContext属性)
在 IBM.XMS.Client.WMQ.WmqConnection.CreateSession(XmsPropertyContext 属性,AcknowledgeMode ackMode)
在 IBM.XMS.Client.Impl.XmsConnectionImpl.CreateSession(布尔 transacted,AcknowledgeMode ackMode)