MqContextC - various functions to config a context … More...
Topics | |
MqContextC_ConfigApi_Misc_C_API | |
MqContextC - various function to do 'misc' configuration … | |
MqContextC_ConfigApi_Set_C_API | |
MqContextC - various function to 'set' the configuration-data in a context … | |
MqContextC_ConfigApi_Get_C_API | |
MqContextC - various function to 'get' the configuration-data from a context … | |
MqContextC_ConfigApi_Interface_C_API | |
MqContextC - various function to setup a interface for the context … | |
Macros | |
#define | MQ_SERVICE_CALL_CHECK |
#define | MQ_SERVICE_CALL_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR const __data__ |
the MqTokenF arguments with default names | |
#define | MQ_SERVICE_CALL MK_RT_CALL mqctx, __data__ |
the MqTokenF arguments CALL with default names | |
#define | MQ_SERVICE_FREE_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP |
the MqDataFreeF arguments with default names | |
#define | MQ_SERVICE_COPY_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP |
the MqDataFreeF arguments with default names | |
Typedefs | |
typedef enum MkErrorE(* | MqTokenF) (MQ_SERVICE_CALL_ARGS) |
prototype for an object method function … | |
typedef void(* | MqDataFreeF) (MQ_SERVICE_FREE_ARGS) |
prototype for a free additional token data function … | |
typedef void(* | MqDataCopyF) (MQ_SERVICE_COPY_ARGS) |
prototype for a copy additional token data function … | |
MqContextC - various functions to config a context …
The configuration is done persistent using config-api functions or on link-setup using command-line-arguments.
set: (runtime) enum MkErrorE MqConfigSetConfigFile(MQ_CTX const ctx, MK_STRN const filename)
add libconfig configuration file …
A config-file is used to add configuration-values to a libmqmsgque-application using a structured text-file.
A service-callback and "programming" is not supported. To "programm and modify" something use a scripting language like tcl or python.
libconfig is used to parse a config-file using the application … --config fileName …
option.
The following restrictions apply to the --config
option.
--config
option is parsed groupname : { ... }
( ":" or "=" is allowed ) MyClient … --XXX … --config YYY … --ZZZ …
MyClient
: XXX < YYY < ZZZ 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 |
--name
or --prefix
option from DDD
or EEE
change the group read from the config-file --config
option--config
option overwrite the options from the config-file 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 1. Example from MyClient.config
→ filter-pipeline with last server start in debug mode
2. Example from libconfig.test
→ filter-pipeline with last server connect by tcp/ip
attribute: MqConfigS::dispname, getter: MqConfigGetName, setter: MqConfigSetName
set the display-name of the context …
The display-name is used as:
C> (dispname) [2009-01-12:16-22-27] [4-0-sIoCheckArg]: option: io->com = PIPE
The dispname is initialized with:
(runtime) void MqConfigSetName(MQ_CTX const ctx, MK_STRN data)
, (runtime) void MqConfigSetPrefix(MQ_CTX const ctx, MK_STRN data)
, (runtime) void MqConfigSetPostfix(MQ_CTX const ctx, MK_STRN data)
function prefix | postfix | dispname |
---|---|---|
client | -1-1 | client-1-1 |
(runtime) void MqConfigSetName(MQ_CTX const ctx, MK_STRN data)
or --name stringattribute: MqConfigS::prefix, getter: MqConfigGetPrefix, setter: MqConfigSetPrefix
set the server-part (1) of the application-identifer MqConfigS::dispname …
The prefix is used for:
The prefix is initialize with:
(runtime) void MqConfigSetPrefix(MQ_CTX const ctx, MK_STRN data)
or the (runtime) void MqConfigSetName(MQ_CTX const ctx, MK_STRN data)
functionattribute: MqConfigS::postfix, getter: MqConfigGetPostfix, setter: MqConfigSetPostfix
set the client-part (2) of the application-identifer MqConfigS::dispname …
The postfix is used for:
The postfix is initialize with:
(runtime) void MqConfigSetPostfix(MQ_CTX const ctx, MK_STRN data)
functionattribute: MqConfigS::storage, getter: MqConfigGetStorage, setter: MqConfigSetStorage
attribute: MqConfigS::identFrom, getter: MqConfigGetIdentFrom, setter: MqConfigSetIdentFrom
select how to identify the application from remote …
An application has TWO possible names:
The --ident-from prefix|factory value decide which on is used.
The application-identification is defined by MqConfigS::identFrom :
MqFactoryS::originalIdent | if ident == MQ_IDENT_FACTORY |
MqConfigS::prefix | if 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 |
attribute: MqIoTcpConfigS, getter: MqConfigGetIoTcp, setter: MqConfigSetIoTcp
configure a context to use a tcp-client-server-link …
[in] | host | client: name of the remote interface (default: localhost) server: name of the local interface (default: listen on all interfaces) |
[in] | port | client: name of the remote port server: name of the local port |
[in] | myhost | client: name of the local interface |
[in] | myport | client: name of the local port |
attribute: MqIoUdsConfigS, getter: MqConfigGetIoUds, setter: MqConfigSetIoUds
configure a context to use a uds-client-server-link …
The uds-socket (http://en.wikipedia.org/wiki/Unix_domain_socket) is usually 50% faster than a local tcp communication but only available on UNIX.
[in] | file | name of a uds-socket-file (default: MK_NULL ) |
attribute: MqIoPipeConfigS, getter: MqConfigGetIoPipe, setter: MqConfigSetIoPipe
configure a context to use a pipe-client-server-link …
The socket option is special because it is used only for internal purpose to submit the socket from the client to the server started as pipe by the client.
[in] | hdl | the file-descriptor-number (default: not set) |
attribute: MqConfigS::startAs, getter: MqConfigGetStartAs, setter: MqConfigSetStartAs
create a new application-context as thread, spawn or fork …
A new application-context is created if:
The allowed integer values for MqConfigS::startAs are:
(default: do not create a new application-context)
set: (runtime) enum MkErrorE MqConfigSetDaemon(MQ_CTX const ctx, MK_STRN pidfile)
This option is not available for libmqmsgque.
attribute: MkRuntimeS::logfile, getter: RMkRuntimeGetLogfile, setter: RMkRuntimeSetLogfile
attribute: MkRuntimeS::isSilent, getter: RMkRuntimeGetIsSilent, setter: RMkRuntimeSetIsSilent
attribute: MkRuntimeS::debug, getter: RMkRuntimeGetDebug, setter: RMkRuntimeSetDebug
attribute: MqIoConfigS::buffersize, getter: MqConfigGetBuffersize, setter: MqConfigSetBuffersize
set the OS specific value for the socket-operation-buffer (default: OS specific)
attribute: MqIoConfigS::pkgsize, getter: MqConfigGetPkgsize, setter: MqConfigSetPkgsize
set maximum package size (default: 10 KiB)
attribute: MqIoConfigS::timeout, getter: MqConfigGetTimeout, setter: MqConfigSetTimeout
user defined timeout to terminate a blocking function call (default: 90 sec)
attribute: MqConfigS::native, getter: MqConfigGetIsString, setter: MqConfigSetIsString
define if data is string or little or big endian …
define the server-setup-interface (callback) used on startup …
This interface is used to configure a new server-context-link, like a constructor, and is called at the end of MqLinkCreate or MqLinkCreateChild. This interface is called for every new incoming connection request and is used to define context specific services using MqServiceCreate or to initialize context-specific variables. As side-effect this interface set MqSetupS::isServer to MK_YES
.
IServerSetup
: callback signatureRead more about how to define a service-callback in theLink .
define the server-cleanup-interface (callback) used on cleanup …
This interface is used to cleanup an old server-context-link, like a destructor, and is called at the beginning of MqLinkDelete to free context-specific variables. As side-effect this interface set MqSetupS::isServer to MK_YES
.
IServerCleanup
: callback signatureRead more about how to define a service-callback in theLink .
define the background-error-interface …
A background error is an error without a link to an application-context and happen if an MqSendEND call fails or if an other asynchronous task fails. if the interface is not defined the error is printed to stderr and the application continue to work. if the interface is defined the context is set to error and the callback is called to process this error. Inside the callback the error is available using ErrorGetNum and ErrorGetText and can be cleared using ErrorReset.
IBgError
: callback signatureRead more about how to define a service-callback in theLink .
Create a link to the calling tool event-handling queue …
Event-Handling is used to process tasks in the background to give the tool-user the feeling of a non-blocking application. For example Tcl using the event-handling to update the Tk user-interface while the application is waiting for data. The event handling function is called on idle-time and is designed for a very short function execution time. Do only one action per function call. This function will be called with a ~10000 usec interval to guarantee a parallel like execution.
example/LANG/Filter4.EXT
IEvent
: callback signatureRead more about how to define a service-callback in theLink .
#define MQ_SERVICE_CALL MK_RT_CALL mqctx, __data__ |
the MqTokenF arguments CALL with default names
Definition at line 931 of file LibMqMsgque_mq.h.
#define MQ_SERVICE_CALL_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR const __data__ |
the MqTokenF arguments with default names
Definition at line 929 of file LibMqMsgque_mq.h.
#define MQ_SERVICE_CALL_CHECK |
Definition at line 922 of file LibMqMsgque_mq.h.
#define MQ_SERVICE_COPY_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP |
the MqDataFreeF arguments with default names
Definition at line 947 of file LibMqMsgque_mq.h.
#define MQ_SERVICE_FREE_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP |
the MqDataFreeF arguments with default names
Definition at line 939 of file LibMqMsgque_mq.h.
typedef void( * MqDataCopyF) (MQ_SERVICE_COPY_ARGS) |
prototype for a copy additional token data function …
Definition at line 950 of file LibMqMsgque_mq.h.
typedef void( * MqDataFreeF) (MQ_SERVICE_FREE_ARGS) |
prototype for a free additional token data function …
Definition at line 942 of file LibMqMsgque_mq.h.
typedef enum MkErrorE( * MqTokenF) (MQ_SERVICE_CALL_ARGS) |
prototype for an object method function …
Definition at line 892 of file LibMqMsgque_mq.h.