Loading...
Searching...
No Matches

end-user configuration data, also available as command-line options More...

#include <LibMqMsgque_mq.h>

+ Collaboration diagram for MqConfigS:

Data Fields

enum MkNativeIsE native
 define if data is string or little or big endian …
 
enum MqStartE startAs
 create a new application-context as thread, spawn or fork … A new application-context is created if:
 
MK_STRB dispname [MqConfigS_dispname_size]
 set the display-name of the context … The display-name is used as:
 
MK_STRB prefix [MqConfigS_prefix_size]
 set the server-part (1) of the application-identifer MqConfigS::dispname
 
MK_STRB postfix [MqConfigS_postfix_size]
 set the client-part (2) of the application-identifer MqConfigS::dispname
 
MQ_CTX parent
 CHILD: a pointer to the parent object or None.
 
MQ_CTX master
 SLAVE: a pointer to the master object or None.
 
MK_NUM master_id
 SLAVE: the ID in the master SLAVES array or O.
 
struct MqIoConfigS io
 Global configuration data belonging to "io".
 
MK_STRB storage [MqConfigS_storage_size]
 
struct { 
 
   bool   dispnameLOCK:1 
 protect name More...
 
   bool   storageLOCK:1 
 protect storage More...
 
   bool   prefixLOCK:1 
 protect prefix More...
 
   bool   postfixLOCK:1 
 protect postfix More...
 
bits 
 boolean bit-fields
 
enum MqIdentE identFrom
 select how to identify the application from remote …
 
config_tcfg
 add libconfig configuration file …
 
config_setting_trootH
 libconfig data root
 
config_setting_tfilterH
 libconfig data root
 

Detailed Description

end-user configuration data, also available as command-line options

Definition at line 1691 of file LibMqMsgque_mq.h.

Field Documentation

◆ [struct]

struct { ... } MqConfigS::bits

boolean bit-fields

◆ cfg

config_t* MqConfigS::cfg

add libconfig configuration file …

introduction

A config-file is used to add configuration-values to a libmqmsgque-application using a structured text-file.

supported
By default command-line-options; filter-pipline and slave-worker-setup is supported.

A service-callback and "programming" is not supported. To "programm and modify" something use a scripting language like tcl or python.

goal
The goal is to give the user of a compiled application the ability to provide a single place for common-configuration-values.

technology

libconfig is used to parse a config-file using the application … --config fileName … option.

syntax
The config-file syntax is defined at: http://hyperrealm.github.io/libconfig/libconfig_manual.html

The following restrictions apply to the --config option.

  1. The config-file is parsed when the --config option is parsed
  2. An application is identfied in the config-file by groupname : { ... } ( ":" or "=" is allowed )
  3. The groupname is the return from MqClassIdentGet using hint from --ident-from prefix|factory
  4. The groupname is modified with the --name string, --prefix string or --ident-from prefix|factory naming-options
  5. The order of option-parsing is the order on the command-line
    MyClient … --XXX … --config YYY … --ZZZ …
    order MyClient : XXX < YYY < ZZZ
  6. For a pipe the config-file from the client is added to the end of the server-options :
    MyClient --AAA … --config BBB --CCC … @ Filter3 --name otto --DDD … @ MyServer --EEE …
    application groupname option-parsing-order
    MyClient MyClient AAA < BBB < CCC
    Filter3 otto DDD < BBB
    MyServer MyServer EEE < BBB
    This is required because the --name or --prefix option from DDD or EEE change the group read from the config-file
  7. attention! on a client or a non-pipe server it is a difference if the naming-option is set before or after the --config option
  8. All options set after the --config option overwrite the options from the config-file
  9. The filter ( groupname : { … filter : [ … ] } ) config-file-option define the server to start in a pipe and have to be an array of strings starting with the application-executable OR the factory-identifer

examples

1. Example from MyClient.config filter-pipeline with last server start in debug mode

# commandline OLD: MyClient @ Filter3 @ MyServer --debug 1
# commandline NEW: MyClient --config MyClient.config
version = "1.0" ; // string : version of the configuration file reader
default = "MyClient" ; // string : if the 'class' is unknown use 'default'
MyClient:
{
config:
{
# name = "myName" ; // string : displayname name of the 'context' (default: executable basename)
# identFrom = "prefix" ; // list : select how to identify the application from remote: 'prefix' or 'factory' (default: prefix)
# prefix = "" ; // string : set the 1'part of the visible displayname (default: "" = FactoryName)
# postfix = "" ; // string : set the 2'part of the visible displayname (default: "" = ConnectionName)
# string = false ; // bool : (default: no)
# startAs = "default" ; // string : from list (ref… MqStartE): default, spawn, thread, fork (default: default)
# daemon = "MyServer.pid" ; // string : file for PID
# timeout = 90 ; // int : user defined timeout to terminate a blocking function call (default: 90 sec)
# storage = "#memdb#" ; // string : storage file for the database: #memdb#, #tmpdb# or filename (default: #memdb#)
# runtime = { // struct (ref… MkRuntimeS) : runtime configuration (global)
# debug = 1 ; // int : set the debug-level, Valid values are 0 <= debug <= 9 using 0 for "no" and 9 for "max". (default: 0)
# silent = false ; // bool : write (no) or don't write (yes) any message to stdout or stderr (default: no)
# logfile = "stderr" ; // string : append to logfile, valid values are: stderr, stdout or a filename (default: stderr)
# };
# io = { // struct (ref… MqIoComE) : what kind of socket interface to use? (default: pipe)
# buffersize = 4096 // int : io buffersize (default: 4096)
# pkgsize = 10240 // int : io pkgsize (default: 10 * 1024)
# pipe = true; // struct (ref… MqIoPipeConfigS) → ONLY client (default: true)
# init = false; // struct (ref… MqIoInitConfigS) → ONLY server (default: false)
# tcp = { // struct (ref… MqIoTcpConfigS)
# port = "7777" ; // string : port number or well known port name
# host = "localhost" ; // string : hostname / interfacename
# myport = "1111" ; // string : client MY port number or well known port name
# myhost = "localhost" ; // string : client MY hostname / interfacename
# };
# uds = { // struct (ref… MqIoUdsConfigS)
# file = "filename" ; // string : name of a uds-socket-file (default: null)
# }
# };
};
# start executable "Filter3" in a "@" pipe and change application-name (groupname) to "otto"
filter = [ "Filter3", "--name", "otto" ] ; // array of string : filter pipeline name of "server"
};
# config section for "Filter3" start in the "pipe"
otto = {
filter = [ "MyServer" ] ;
}
# final "MyServer" set option "debug" to "1"
MyServer = {
config: { runtime: {debug = 1} }
# 'config.runtime.debug = 1' is NOT supported.
}

2. Example from libconfig.test filter-pipeline with last server connect by tcp/ip

# OLD: MyClient @ Filter3 @ --tcp --port $PORT
# NEW: MyClient --config configFile
version: 1.0
default = "MyClient"
MyClient: {
filter: [ "Filter3" ]
}
Filter3: {
filter: [ "--tcp", "--port", "$PORT" ]
}

Definition at line 1899 of file LibMqMsgque_mq.h.

◆ dispname

MK_STRB MqConfigS::dispname[MqConfigS_dispname_size]

set the display-name of the context … The display-name is used as:

  • A prefix in the local debug/error/log output:
    • C> (dispname) [2009-01-12:16-22-27] [4-0-sIoCheckArg]: option: io->com = PIPE

The dispname is initialized with:

Example
use MqConfigS::prefix and MqConfigS::postfix to set the MqConfigS::dispname :
  • prefix postfix dispname
    client -1-1 client-1-1
Attention

Definition at line 1746 of file LibMqMsgque_mq.h.

◆ dispnameLOCK

bool MqConfigS::dispnameLOCK

protect name

Definition at line 1803 of file LibMqMsgque_mq.h.

◆ filterH

config_setting_t* MqConfigS::filterH

libconfig data root

Definition at line 1905 of file LibMqMsgque_mq.h.

◆ identFrom

enum MqIdentE MqConfigS::identFrom

select how to identify the application from remote …

An application has TWO possible names:

  1. The name from the context the application was configured with.
  2. The name from the factory the application was created with.

The --ident-from prefix|factory value decide which on is used.

The application-identification is defined by MqConfigS::identFrom :

MqFactoryS::originalIdentif ident == MQ_IDENT_FACTORY
MqConfigS::prefixif ident == MQ_IDENT_PREFIX (default)

The MqFactoryS::originalIdent is the official name of the MqFactoryC and is defined by the application-programmer with MqFactoryAdd or MqFactoryDup2.

The MqConfigS::prefix is the official name of the MqContextC that startet first, usually the server-name, and is set by the application-user with --prefix string at startup or with the MqConfigSetPrefix at setup.

When the server starts, the MqClassIdentGet value is send from the server to the client and the client initializes the MqLinkS::targetIdent with this value. This value identifes the server from remote and is used by the MqContextC ROUTE API to select which server receive the routing-package.

The client usually get the factory and the idenfication from the: MqFactoryInitial.

Example: Change the factory-identifier of MqFactoryInitial to the value "TestClient" with:

C# MqFactoryC.Get("initial").Dup2("TestClient").Initial()
TCL [[tclmsgque::MqFactoryC Get "initial"] Dup2 "TestClient"] Initial
Note
After the link-start, the MqLinkS::targetIdent is no longer changed.

Definition at line 1847 of file LibMqMsgque_mq.h.

◆ io

struct MqIoConfigS MqConfigS::io

Global configuration data belonging to "io".

Definition at line 1790 of file LibMqMsgque_mq.h.

◆ master

MQ_CTX MqConfigS::master

SLAVE: a pointer to the master object or None.

Definition at line 1784 of file LibMqMsgque_mq.h.

◆ master_id

MK_NUM MqConfigS::master_id

SLAVE: the ID in the master SLAVES array or O.

Definition at line 1787 of file LibMqMsgque_mq.h.

◆ native

enum MkNativeIsE MqConfigS::native

define if data is string or little or big endian …

Definition at line 1694 of file LibMqMsgque_mq.h.

◆ parent

MQ_CTX MqConfigS::parent

CHILD: a pointer to the parent object or None.

Definition at line 1781 of file LibMqMsgque_mq.h.

◆ postfix

MK_STRB MqConfigS::postfix[MqConfigS_postfix_size]

set the client-part (2) of the application-identifer MqConfigS::dispname

The postfix is used for:

  1. MqConfigS::dispname initialization

The postfix is initialize with:

  1. an empty string
  2. the ctx.ConfigSetPostfix(data:string) function
  3. the client postfix at server-startup
  4. the --postfix string option
Attention
if the --name string is explicitly set, then --prefix string and --postfix string have no effect

Definition at line 1778 of file LibMqMsgque_mq.h.

◆ postfixLOCK

bool MqConfigS::postfixLOCK

protect postfix

Definition at line 1806 of file LibMqMsgque_mq.h.

◆ prefix

MK_STRB MqConfigS::prefix[MqConfigS_prefix_size]

set the server-part (1) of the application-identifer MqConfigS::dispname

The prefix is used for:

  1. MqConfigS::dispname initialization
  2. application-identifer if --ident-from prefix|factory is set to prefix (default)
  3. groupname in --config fileName is used as application-identifer

The prefix is initialize with:

  1. the basename of the executable if NO factory is used
  2. the MqFactoryS::originalIdent
  3. the ctx.ConfigSetPrefix(data:string) or the ctx.ConfigSetName(data:string) function
  4. the --name string OR the --prefix string option
Attention
if the --name string is explicitly set, then --prefix string and --postfix string have no effect

Definition at line 1763 of file LibMqMsgque_mq.h.

◆ prefixLOCK

bool MqConfigS::prefixLOCK

protect prefix

Definition at line 1805 of file LibMqMsgque_mq.h.

◆ rootH

config_setting_t* MqConfigS::rootH

libconfig data root

Definition at line 1902 of file LibMqMsgque_mq.h.

◆ startAs

enum MqStartE MqConfigS::startAs

create a new application-context as thread, spawn or fork … A new application-context is created if:

  • a tcp-uds-server listen on socket and get a connection-request from a client.
    This require: MqFactoryC and IServerSetup .
  • a filter-context create a new filter-object
  • a server-context create a new worker-context using MqSlaveWorker
  • a server-context start a new client-server-link using SELF as executable-name using MqLinkCreate

The allowed integer values for MqConfigS::startAs are:

  • MqStartE.DEFAULT = 0, use application-context default entity creation
  • MqStartE.FORK = 1, create entity as fork
  • MqStartE.THREAD = 2, create entity as thread
  • MqStartE.SPAWN = 3, create entity as spawn process

(default: do not create a new application-context)

Definition at line 1716 of file LibMqMsgque_mq.h.

◆ storage

MK_STRB MqConfigS::storage[MqConfigS_storage_size]

Definition at line 1800 of file LibMqMsgque_mq.h.

◆ storageLOCK

bool MqConfigS::storageLOCK

protect storage

Definition at line 1804 of file LibMqMsgque_mq.h.


The documentation for this struct was generated from the following file: