I am having this random issue while publishing JSON string messages to IBM MQ topic. It happens so randomly all the time. I am not sure how to pinpoint the issue. This is happening since I switched to SSL Channel.
IBM.XMS.dll version I am using is 8.0.0.6. Following is the code snippet and exception details:
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();
}
}
Exception:
Stack Trace:
at IBM.WMQ.MQFAP.NmqiConnect(String name, NmqiConnectOptions pNmqiConnectOpts, MQConnectOptions cno, Hconn parentHconn, Phconn pHconn, Int32& compCode, Int32& reason, ManagedHconn rcnHconn)
at IBM.WMQ.MQFAP.NmqiConnect(String pQMgrName, NmqiConnectOptions pNmqiConnectOpts, MQConnectOptions pConnectOpts, Hconn parentHconn, Phconn pHconn, Int32& pCompCode, Int32& pReason)
at IBM.XMS.Client.WMQ.WmqSession..ctor(WmqConnection connection, AcknowledgeMode ackMode, XmsPropertyContext properties)
at IBM.XMS.Client.WMQ.WmqConnection.CreateSession(XmsPropertyContext properties, AcknowledgeMode ackMode)
at IBM.XMS.Client.Impl.XmsConnectionImpl.CreateSession(Boolean transacted, AcknowledgeMode ackMode)