| Segment | Size | Type | Default | Description |
| HDR | 3 | string | "HDR" | fixed prefix |
| Separator | 1 | char | '+' | fixed separator |
| BinaryFlag | 1 | char | 'S' or 'B' | string or binary mode |
| StatisticFlag | 1 | char | '1' - '9' | statistic level |
| DebuggingFlag | 1 | char | '1' - '9' | debugging level |
| VerboseFlag | 1 | char | 'Y' or 'N' | using verbose output? |
| Separator | 1 | char | '+' | fixed separator |
| MyContext | 10 | pointer | 0x???????? | my MqS object |
| Separator | 1 | char | '+' | fixed separator |
| RemoteContext | 10 | pointer | 0x???????? | remote MqS object |
| Separator | 1 | char | '+' | fixed separator |
| BodySize | 10 | integer | 0123456789 | the size of [BODY] |
| Separator | 1 | char | '+' | fixed separator |
| Token | 4 | string | "????" | handle name |
| Separator | 1 | char | '+' | fixed separator |
| TransactionPtr | 10 | pointer | 0x???????? | MqTransS object |
| Separator | 1 | char | '+' | fixed separator |
| Segment | Size | Type | Default | Description |
| BDY | 3 | string | "BDY" | fixed prefix |
| Separator | 1 | char | '+' | fixed separator |
| Segment | Size | Type | Default | Description |
| Size | 6 | integer | 0123456789 | the size of Value |
| Separator | 1 | char | '+' | fixed separator |
| Type | 1 | char | MqTypeE | the type of Value |
| Separator | 1 | char | '+' | fixed separator |
| Value | ? | binary | ?????????? | the [ITEM] data |
| Separator | 1 | char | '+' | fixed separator |
libtcl*.so libfreiburg*.so main.c context.c
ErrorCheck(MqProcessEvent(msgque, MQ_TIMEOUT, MQ_WAIT|MQ_FOREVER));
static ErrorE EVAL(MsgqueS *msgque, void* data) { ErrorCheck(MqReadC(msgque->read, &buf)); // read string ... if (Tcl_Eval(msgque->myCtx->interp,buf) == TCL_ERROR) goto error; // do the 'eval' .... MqSendSTART(msgque->send); MqSendC(msgque->send, Tcl_GetStringResult(msgque->myCtx->interp)); // the result back MqSend_RET_OK(msgque->send); // everything is OK return MqSendEND_RETR(msgque->send,NULL); // do the send error: // ... set the error return MqSendRETURN(msgque->send, ERROR_PROC_FMT, __func__); }
OLD: Database NEW: Database *
| | *
ArsServer ArsServer *
| | | | <- Ars-Protocol *
Ars-Protocol -> | | ArsService1 ArsService2 <- Freiburg-API + Ars-API *
| | | | <- Freiburg-Protocol *
Ars-API -> Client1 Client2 Client1 Client2 <- Freiburg-API *
YES: 'closed' NO: 'open' *
Application Application *
Application-API: -> | | | | *
Service1 Service2 | | <- Freiburg-API *
Freiburg-API: -> | | | | *
Client1 Client2 Client1 Client2 *
send $CTX -wait .... is calling the event-loop to process additional events, even of the same typeset Ctx [ArsService::Start -name MyApplication -uds]; # client-parent create and start >>ArsService<< ArsService::Login $Ctx -wait LOGI User1 Pwd1 Server1 Enc1;# client-parent login into server1 ArsService::DoSomeWork $Ctx -wait DOSW .... # client-parent is doing some work on server1 set Cx2 [ArsService::Start -parent $Ctx] # client-parent create a child ArsService::Login $Cx2 -wait LOGI User2 Pwd2 Server2 Enc2;# client-child login into server2 ArsService::DoSomeWork $Cx2 -wait DOSW .... # client-child is doing some work on server2 ArsService::Logout $Cx2; # client-child does a 'logout' from server2 ArsService::Login $Cx2 -wait LOGI User3 Pwd3 Server3 Enc3;# client-child login into server3 ArsService::DoSomeWork $Cx2 -wait DOSW .... # client-child is doing some work on server3 ArsService::DoSomeWork2 $Ctx -wait DSW2 .... # client-parent is doing some additional work on server1 ArsService::Logout $Cx2; # client-child does a 'logout' from server3 rename $Cx2 ""; # client-child destroy ArsService::Logout $Ctx; # client-parent does a 'logout' from server1 rename $Ctx ""; # client-parent destroy and stop >>ArsService<<
# SLEP ... service doing a 'sleep' system-call on the server -> blocking the server # client is doing the following 3 jobs after 100 "send $CTX1 -wait SLEP 10"; # test-case: service sleeps 10 seconds after 100 "send $CTX2 -wait SLEP 5"; # test-case: service sleeps 5 seconds after 100 "send $CTX3 -wait SLEP 8"; # test-case: service sleeps 8 seconds # wait on finish all 3 jobs
# SLEP ... service doing a 'sleep' system-call on the server -> blocking the server # client is doing the following 3 jobs after 100 "send $CTX -wait SLEP 10"; # test-case: service sleeps 10 seconds after 100 "send $CTX -wait SLEP 5"; # test-case: service sleeps 5 seconds after 100 "send $CTX -wait SLEP 8"; # test-case: service sleeps 8 seconds # wait on finish all 3 jobs
// start: call a service and wait for the answer MqErrorCheck (MqSendEND_AND_WAIT (send, token, timeout)); // read all result items MqReadSP const read = msgque->read; while (MqGetNumItems (read)) { TclErrorCheck (MqRead? (read, ????)); ... } // check the return code if (MqReadGetReturnCode(read) != 'O') { // something is wrong ... MqReadSP readRef; int retNum = MqReadGetReturnNum(read); char retCode = MqReadGetReturnCode(read); MqReadCreate_RET_Ref (read, &readRef); // read all return-message items while (MqGetNumItems (read)) { TclErrorCheck (MqRead? (read, ????)); ... } MqReadDelete_RET_Ref (&readRef); // return ERROR } // everything is OK return result items
proc ::TclExceptionProc { Ctx Token RetCode RetNum RetList } {
set msg "\[$Ctx\] Token:$Token, RetNum:$RetNum, RetText:[join $RetList -]"
if {$RetCode eq "W"} {
puts stderr $msg
} else {
error $msg
}
}
set Ctx [msgque create ... -exception ::TclExceptionProc ...]
$Ctx send -wait TEST ....
1.3.8-20040928