MqContextC - construct an outgoing send-data-package … More...
MqContextC - construct an outgoing send-data-package …
A data-package is send in two different scenarios:
Sending data is an active task and the opposite of reading data, which is a passive task. Active means that the send process is triggered by the software workflow or by the user.
For each basic type defined in MkBufferC*, there is a send function and some help functions.
If timeout != 0 is used, the application enters the event loop and waits in the current process or thread for timeout seconds until the service call is finished.
While waiting for a result, the application can continue to work on other events that are in the same or in a different process or thread.
Example-1: a service call, send and read a data-package
On a client: perform a service call
send the service-call | MqSendSTART → SendTT... → MqSendEND_AND_WAIT |
read the result package | ReadTT... → ... |
on a server: answer a service call
read the service-call | ReadTT... → ... |
send the result package | MqSendSTART → SendTT... → MqSendRETURN |
Important in the code from above is the last command MqSendEND_AND_WAIT because this is just one of five possibilities:
command | synchron | database | result |
---|---|---|---|
MqSendEND | no | no | no |
MqSendEND_AND_WAIT | yes | no | single return data |
MqSendEND_AND_SUB | yes | no | multiple return data |
MqSendEND_AND_CALLBACK | no | no | single return data |
MqSendEND_AND_TRANSACTION | no | yes | two return data |
To send a data-package is one task, to send it to the right receiver is an other one. The right receiver is identified using the token parameter argument. This parameter have to be a 4 character string. You'll probably ask "why 4?" the answer is that this string should be "human" readable and easy to "compare". As solution this string is mapped to a 4 byte integer used to find the proper key/value entry in the service-hash-table on the server. (in short: to search an integer is much faster as to search a string)
Example-2: (in C) At the client, calling the service and wait for an answer
... or using the MqContextC HIGH API
Example-3: (in C) At the server, answer the service call
... or using the MqContextC HIGH API
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | const std::string & | str, |
IService *const | service, | ||
... ) |
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | const std::string & | str, |
MqTokenCCB const | callback, | ||
... ) |
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | const std::string & | str, |
MqTokenICB const | callback, | ||
... ) |
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | const std::string & | str, |
... ) |
Definition at line 148 of file MqHigh_cc.cc.
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | MK_STRN | cstr, |
IService *const | service, | ||
... ) |
C++:
→ C-API ctx.Send(MK_STRN cstr, ... )
user friendly replacement for the MqContextC_SendApi_C_API … default ccmqmsgque::IService
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | MK_STRN | cstr, |
MqTokenCCB const | callback, | ||
... ) |
C++:
→ C-API ctx.Send(MK_STRN cstr, ... )
user friendly replacement for the MqContextC_SendApi_C_API … default MqTokenCCB
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | MK_STRN | cstr, |
MqTokenICB const | callback, | ||
... ) |
C++:
→ C-API ctx.Send(MK_STRN cstr, ... )
user friendly replacement for the MqContextC_SendApi_C_API … default MqTokenICB
MkBufferListC * ccmqmsgque::MqContextC::Send | ( | MK_STRN | cstr, |
... ) |
C++:
→ C-API ctx.Send(MK_STRN cstr, ... )
user friendly replacement for the MqContextC_SendApi_C_API … default MqTokenICB
Definition at line 134 of file MqHigh_cc.cc.
|
private |