Configuration files
Uniloader is able to read and write configuration files and properties.
QueueMetrics configuration.properties / 'arch_properties' table
QueueMetrics properties used to be stored in text file called configuration.properties
.
With version 24.10, they were moved to a database table called arch_properties
.
Uniloader works identically -
but if you want to connect to the database of a QM system, you need to specify it using
the following properties:
OPTIONS: --dburi value The database to connect to. E.g. 'tcp(127.0.0.1:3306)/queuemetrics?allowOldPasswords=1' --login value A database user (default: "queuemetrics") --pwd value A database password [$PWD]
If no database is specified, the text file will be attempted. An example of these properties are used is given in the example below.
Reading a property: get
You can esily check the status of a QueueMetrics property programmatically, by calling:
uniloader cfgfile get -p realtime.agentPausedOnLogin false
or (using the database):
uniloader cfgfile --dburi "tcp(127.0.0.1:3306)/queuemetrics?allowOldPasswords=1" --pwd javadude get -p realtime.agentPausedOnLogin
You will usually save the property to a bash variable for further decisions.
Full invocation:
NAME: uniloader cfgfile get - Reads a property and prints it on STDOUT. USAGE: uniloader cfgfile get [command options] [arguments...] DESCRIPTION: Reads a configuration.properties file and prints on STDOUT the value that was found. Can be used in Bash like: AUDIO=$(uniloader cfgfile get -f configuration.properties -p audio.url) as to capture the value in a variable. OPTIONS: --properties-file, -f "configuration.properties" The properties file --property, -p The name of the property to read --default, -d The default value
If you specify a default value, it will be returned in case the property was never set.
Writing a property: put
You can set a property to a desired value:
uniloader cfgfile put -p realtime.agentPausedOnLogin -v true -c "Customization 1"
In file mode, the optional comment will be prepended to the property, like:
# Customization 1 realtime.agentPausedOnLogin=true
Full invocation:
NAME: uniloader cfgfile put - Sets a property in a properties file. USAGE: uniloader cfgfile put [command options] [arguments...] DESCRIPTION: This command will set the property you define in a Java properties file or similar. If the property is already present with the same value, it is not changed; otherwise the previous value is commented out and the new one is appended to the end of the file with an optional comment. The file is always overwritten. OPTIONS: --properties-file value, -f value The properties file. If --dburi is specified, unused. --property value, -p value The name of the property to set. --value value, -v value The new value. --comment value, -c value An optional comment --forced-replacement value If set to 1, the property and its comments will be replaced (default: 0) --locked value If set to 1, the property is locked and cannot be changed within QM (default: 0)
In case the property is unchanged, the transaction is not performed. A property won’t be changed if you set it to the same value multiple times - Uniloader detects that the value does not need changing and won’t perform the transaction. In this case, a message will be printed for your reference.
Locking a property
By locking a property, that is setting it to a given value and adding --locked 1
to the invocation,
that property will not be changeable from within QueueMetrics. Any attempt to do so
will trigger an error. Any property created without that flag will by default be unlocked.
To unlock a property, you need to set it again adding --locked 0
to its invocation. If the
property value is actually unchanged, and its lock status is supposed to change, no new
property is created, but its lock status is changed.
If both the property value and its lock status are unchanged, then no
change is performed.
When a lock status is changed, a message is printed, e.g.:
2024/10/29 17:53:27 Property 'my.special.property' unchanged - no update needed 2024/10/29 17:53:27 Property 'my.special.property' lock changed - Now locked=false
The Now locked
part shows whether the property is currently locked or not.