We develop an .NET application which connects to IBM MQ with IBM XMS library.
It's working, but the produced messages contains the MQRFH2 header, which the target application cannot process, so we have to remove it.
This normally can be done by set a property like https://www.ibm.com/docs/en/ibm-mq/9.1?topic=definitions-xmsc-wmq-target-client.
We tried this by setting cf.SetIntProperty(IBM.XMS.XMSC.WMQ_TARGET_CLIENT, IBM.XMS.XMSC.WMQ_TARGET_DEST_MQ);
IBM.XMS.IConnection connectionWMQ;
IBM.XMS.XMSFactoryFactory factoryFactory;
IBM.XMS.IConnectionFactory cf;
factoryFactory = IBM.XMS.XMSFactoryFactory.GetInstance(IBM.XMS.XMSC.CT_WMQ);
cf = factoryFactory.CreateConnectionFactory();
cf.SetStringProperty(IBM.XMS.XMSC.WMQ_HOST_NAME, mqQueueOptions.HostName);
cf.SetIntProperty(IBM.XMS.XMSC.WMQ_PORT, mqQueueOptions.Port);
cf.SetStringProperty(IBM.XMS.XMSC.WMQ_CHANNEL, mqQueueOptions.Channel);
cf.SetIntProperty(IBM.XMS.XMSC.WMQ_CONNECTION_MODE, IBM.XMS.XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(IBM.XMS.XMSC.WMQ_QUEUE_MANAGER, mqQueueOptions.QueueManager);
cf.SetIntProperty(IBM.XMS.XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, IBM.XMS.XMSC.WMQ_CLIENT_RECONNECT);
cf.SetIntProperty(IBM.XMS.XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, IBM.XMS.XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT_DEFAULT);
cf.SetIntProperty(IBM.XMS.XMSC.WMQ_TARGET_CLIENT, IBM.XMS.XMSC.WMQ_TARGET_DEST_MQ);
But then we get:
Retry 00:00:02 of RetryPolicy-1d242dc3 at , due to: 'IBM.XMS.XMSException: Value 1 not valid for property: targetClient
at IBM.XMS.Client.Impl.XmsPropertyContextImpl.SetObjectPropertyInternal(String name, Object value, Boolean validationEnabled)
at IBM.XMS.Client.Impl.XmsPropertyContextImpl.SetObjectProperty(String name, Object value)
at IBM.XMS.Client.Impl.XmsPropertyContextImpl.SetIntProperty(String name, Int32 value)
What's the problem?
Tried by setting cf.SetIntProperty(IBM.XMS.XMSC.WMQ_TARGET_CLIENT, IBM.XMS.XMSC.WMQ_TARGET_DEST_MQ);
to remove the RF2H header but get exception of invalid value for the property.