What is the precedence in qpid broker options?
Environment
Red Hat Enterprise MRG Messaging (any version)
Issue
Having qpid broker parameters specified in:
- environmental variables like
export QPID_PORT=5672 - command line option (like
--port=5672) - configuration file (like
port=5672)
what is their precedence? What setting for an option will be used, if the option is specified on multiple places?
Resolution
Options are set with this precedence:
- command line option
- environmental variable
- configuration file
That means, if an option is specified e.g. in command line and in configuration file, the value from command line will be used.
This strictly applies also to log-enable option that can be specified multiple times - see this solution for details.
Diagnostic Steps
Example: having AMQP listening port defined on multiple configuration places and checking what port the broker will listen on:
$ export QPID_PORT=10001
$ echo "port=10002" > port.conf
$ qpidd --config=port.conf --port=10003 2>&1 | grep "Listening on"
2013-10-25 11:18:20 [Network] notice Listening on TCP/TCP6 port 10003
^C
$ qpidd --config=port.conf 2>&1 | grep "Listening on"
2013-10-25 11:18:56 [Network] notice Listening on TCP/TCP6 port 10001
^C
$ unset QPID_PORT
$ qpidd --config=port.conf 2>&1 | grep "Listening on"
2013-10-25 11:19:28 [Network] notice Listening on TCP/TCP6 port 10002
^C
$
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.