I am looking for a way to programmatically set client attributes inside an IBM MQ Java client application. I do realise IBM provides a way of configuring MQ Clients using a mqclient.ini
file, however due to the nature of deployment and distribution of the application I'm working on it is not possible to use such a file. Hence, I want to set a stanza attribute that would normally be defined in the ini file, inside the connetion configuration block of my code.
Furthermore, I am aware that certain properties can be set as environment variables or Java command line arguments, but that would not be a viable workaround due to the same reasons mentioned above.
In particular I'm interested in the setting the KeepAlive
attribute in the TCP stanza to YES.
So far I have attempted the following ways of achieving that using an MQQueueConnectionFactory
:
connectionFactory.setStringProperty("KeepAlive", "YES");
connectionFactory.setStringProperty("com.ibm.mq.cfg.TCP.KeepAlive", "YES");
connectionFactory.setBooleanProperty("KeepAlive", true);
connectionFactory.setBooleanProperty("com.ibm.mq.cfg.TCP.KeepAlive", true);
However, none of those have had any effect.
For the record I am using IBM MQ classes for JMS version 8.