How to set stanza properties without a mqclient.ini file in a Java IBM MQ client?
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.
java ibm-mq
add a comment |
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.
java ibm-mq
Can you explain what you are trying to solve by settingKeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on aSVRCONNchannel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.
– JoshMc
Nov 15 '18 at 0:17
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44
add a comment |
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.
java ibm-mq
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.
java ibm-mq
java ibm-mq
edited Nov 14 '18 at 19:21
JoshMc
5,5591624
5,5591624
asked Nov 14 '18 at 15:55
omniversealomniverseal
62
62
Can you explain what you are trying to solve by settingKeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on aSVRCONNchannel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.
– JoshMc
Nov 15 '18 at 0:17
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44
add a comment |
Can you explain what you are trying to solve by settingKeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on aSVRCONNchannel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.
– JoshMc
Nov 15 '18 at 0:17
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44
Can you explain what you are trying to solve by setting
KeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on a SVRCONN channel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.– JoshMc
Nov 15 '18 at 0:17
Can you explain what you are trying to solve by setting
KeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on a SVRCONN channel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.– JoshMc
Nov 15 '18 at 0:17
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44
add a comment |
1 Answer
1
active
oldest
votes
You can use Java system properties for this purpose.
The following Java system property will be read by IBM MQ classes for JMS to tell it to use TCP KeepAlive:
com.ibm.mq.cfg.TCP.KeepAlive=YES
To set this programmatically just use System.setProperty method for example:
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive","YES");
Oracle documents the setProperty method in the Class System:
setProperty
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
IBM "loosly" documents specifying a mqclient.ini setting as a system property in the IBM MQ v8 Knowledge center page The IBM MQ classes for JMS configuration file:
Overriding properties specified in an IBM MQ MQI client configuration file
An IBM MQ MQI client configuration file can also specify properties
that are used to configure IBM MQ classes for JMS. However, properties
specified in an IBM MQ MQI client configuration file apply only when
an application connects to a queue manager in client mode.
If required, you can override any attribute in a IBM MQ MQI client
configuration file by specifying it as a property in a IBM MQ classes
for JMS configuration file. To override an attribute in a IBM MQ MQI
client configuration file, use an entry with the following format in
the IBM MQ classes for JMS configuration file:
com.ibm.mq.cfg. stanza. propName = propValueCopy
The variables in the entry have the following meanings:
stanza The name of the stanza in the IBM MQ MQI client configuration file that contains the attribute
propName The name of the attribute as specified in the IBM MQ MQI client configuration file
propValue The value of the property that overrides the value of the attribute specified in the IBM MQ MQI client configuration file
Alternatively, you can override an attribute in an IBM MQ MQI client
configuration file by specifying the property as a system
property on the java command. Use the preceding format to specify
the property as a system property.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304150%2fhow-to-set-stanza-properties-without-a-mqclient-ini-file-in-a-java-ibm-mq-client%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use Java system properties for this purpose.
The following Java system property will be read by IBM MQ classes for JMS to tell it to use TCP KeepAlive:
com.ibm.mq.cfg.TCP.KeepAlive=YES
To set this programmatically just use System.setProperty method for example:
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive","YES");
Oracle documents the setProperty method in the Class System:
setProperty
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
IBM "loosly" documents specifying a mqclient.ini setting as a system property in the IBM MQ v8 Knowledge center page The IBM MQ classes for JMS configuration file:
Overriding properties specified in an IBM MQ MQI client configuration file
An IBM MQ MQI client configuration file can also specify properties
that are used to configure IBM MQ classes for JMS. However, properties
specified in an IBM MQ MQI client configuration file apply only when
an application connects to a queue manager in client mode.
If required, you can override any attribute in a IBM MQ MQI client
configuration file by specifying it as a property in a IBM MQ classes
for JMS configuration file. To override an attribute in a IBM MQ MQI
client configuration file, use an entry with the following format in
the IBM MQ classes for JMS configuration file:
com.ibm.mq.cfg. stanza. propName = propValueCopy
The variables in the entry have the following meanings:
stanza The name of the stanza in the IBM MQ MQI client configuration file that contains the attribute
propName The name of the attribute as specified in the IBM MQ MQI client configuration file
propValue The value of the property that overrides the value of the attribute specified in the IBM MQ MQI client configuration file
Alternatively, you can override an attribute in an IBM MQ MQI client
configuration file by specifying the property as a system
property on the java command. Use the preceding format to specify
the property as a system property.
add a comment |
You can use Java system properties for this purpose.
The following Java system property will be read by IBM MQ classes for JMS to tell it to use TCP KeepAlive:
com.ibm.mq.cfg.TCP.KeepAlive=YES
To set this programmatically just use System.setProperty method for example:
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive","YES");
Oracle documents the setProperty method in the Class System:
setProperty
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
IBM "loosly" documents specifying a mqclient.ini setting as a system property in the IBM MQ v8 Knowledge center page The IBM MQ classes for JMS configuration file:
Overriding properties specified in an IBM MQ MQI client configuration file
An IBM MQ MQI client configuration file can also specify properties
that are used to configure IBM MQ classes for JMS. However, properties
specified in an IBM MQ MQI client configuration file apply only when
an application connects to a queue manager in client mode.
If required, you can override any attribute in a IBM MQ MQI client
configuration file by specifying it as a property in a IBM MQ classes
for JMS configuration file. To override an attribute in a IBM MQ MQI
client configuration file, use an entry with the following format in
the IBM MQ classes for JMS configuration file:
com.ibm.mq.cfg. stanza. propName = propValueCopy
The variables in the entry have the following meanings:
stanza The name of the stanza in the IBM MQ MQI client configuration file that contains the attribute
propName The name of the attribute as specified in the IBM MQ MQI client configuration file
propValue The value of the property that overrides the value of the attribute specified in the IBM MQ MQI client configuration file
Alternatively, you can override an attribute in an IBM MQ MQI client
configuration file by specifying the property as a system
property on the java command. Use the preceding format to specify
the property as a system property.
add a comment |
You can use Java system properties for this purpose.
The following Java system property will be read by IBM MQ classes for JMS to tell it to use TCP KeepAlive:
com.ibm.mq.cfg.TCP.KeepAlive=YES
To set this programmatically just use System.setProperty method for example:
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive","YES");
Oracle documents the setProperty method in the Class System:
setProperty
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
IBM "loosly" documents specifying a mqclient.ini setting as a system property in the IBM MQ v8 Knowledge center page The IBM MQ classes for JMS configuration file:
Overriding properties specified in an IBM MQ MQI client configuration file
An IBM MQ MQI client configuration file can also specify properties
that are used to configure IBM MQ classes for JMS. However, properties
specified in an IBM MQ MQI client configuration file apply only when
an application connects to a queue manager in client mode.
If required, you can override any attribute in a IBM MQ MQI client
configuration file by specifying it as a property in a IBM MQ classes
for JMS configuration file. To override an attribute in a IBM MQ MQI
client configuration file, use an entry with the following format in
the IBM MQ classes for JMS configuration file:
com.ibm.mq.cfg. stanza. propName = propValueCopy
The variables in the entry have the following meanings:
stanza The name of the stanza in the IBM MQ MQI client configuration file that contains the attribute
propName The name of the attribute as specified in the IBM MQ MQI client configuration file
propValue The value of the property that overrides the value of the attribute specified in the IBM MQ MQI client configuration file
Alternatively, you can override an attribute in an IBM MQ MQI client
configuration file by specifying the property as a system
property on the java command. Use the preceding format to specify
the property as a system property.
You can use Java system properties for this purpose.
The following Java system property will be read by IBM MQ classes for JMS to tell it to use TCP KeepAlive:
com.ibm.mq.cfg.TCP.KeepAlive=YES
To set this programmatically just use System.setProperty method for example:
System.setProperty("com.ibm.mq.cfg.TCP.KeepAlive","YES");
Oracle documents the setProperty method in the Class System:
setProperty
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
IBM "loosly" documents specifying a mqclient.ini setting as a system property in the IBM MQ v8 Knowledge center page The IBM MQ classes for JMS configuration file:
Overriding properties specified in an IBM MQ MQI client configuration file
An IBM MQ MQI client configuration file can also specify properties
that are used to configure IBM MQ classes for JMS. However, properties
specified in an IBM MQ MQI client configuration file apply only when
an application connects to a queue manager in client mode.
If required, you can override any attribute in a IBM MQ MQI client
configuration file by specifying it as a property in a IBM MQ classes
for JMS configuration file. To override an attribute in a IBM MQ MQI
client configuration file, use an entry with the following format in
the IBM MQ classes for JMS configuration file:
com.ibm.mq.cfg. stanza. propName = propValueCopy
The variables in the entry have the following meanings:
stanza The name of the stanza in the IBM MQ MQI client configuration file that contains the attribute
propName The name of the attribute as specified in the IBM MQ MQI client configuration file
propValue The value of the property that overrides the value of the attribute specified in the IBM MQ MQI client configuration file
Alternatively, you can override an attribute in an IBM MQ MQI client
configuration file by specifying the property as a system
property on the java command. Use the preceding format to specify
the property as a system property.
edited Nov 15 '18 at 0:13
answered Nov 14 '18 at 19:19
JoshMcJoshMc
5,5591624
5,5591624
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304150%2fhow-to-set-stanza-properties-without-a-mqclient-ini-file-in-a-java-ibm-mq-client%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you explain what you are trying to solve by setting
KeepAlive=YES? Usually you can obtain the same results by proper configuration of the IBM MQ heart beat interval settings. The default settings on aSVRCONNchannel will result in a MQ level TIMEOUT of 6 minutes, but it is easy to adjust this down to a much more reasonable value. If you can explain the problem you want to solve I can add some info in my answer on that setting as well.– JoshMc
Nov 15 '18 at 0:17
Hi omniverseal, if my answer solved your problem please accept it. If you want to know more about how heart beat settings can help please explain the issue you want to solve with keepalive.
– JoshMc
Nov 22 '18 at 9:44