MqContextC - create and manage a service … More...
MqContextC - create and manage a service …
To provide a service is the main purpose of a server and the main-purpose of a client/server connection is to call a service and to process the result.
A service can be defined on the server or on the client. On the server a service can be initial setup with MqServerSetupIF method and finally cleanup with MqServerCleanupIF.
A service is created with the MqServiceCreate and deleted with the MqServiceDelete.
A service can be created and deleted during the entire life-cycle of the server or the client. If the server/client-context is deleted all services of the are deleted also.
A MqServiceDelete is not required.
Creating or deleting a service is like granting or revoking the right to access a single feature.
eventloop
callback
Example from MyServer.tcl
→ define the service HLWO on the server-link-setup
package require tclmqmsgque namespace import tclmqmsgque::* namespace import tclmkkernel::* # package-item ::oo::class create MyServer { superclass MqContextC # service to serve all incoming requests for token "HLWO" method myFirstService {} { my SendSTART my SendSTR "[my ReadSTR] World" my SendRETURN } # define a service as link between the token "HLWO" and the callback "MyFirstService" method serverSetup {} { my ServiceCreate "HLWO" myFirstService } # factory startup (constructor) constructor {{tmpl ""}} { next $tmpl my ConfigSetServerSetup serverSetup } } # package-main tclmqmsgque::Main { # setup commandline arguments for later use set args [MkBufferListC CreateLA {*}$argv] # create "MyServer" factory... and make it to the default. #set fct [[MqFactoryC Add MyServer] Default] set fct [[MqFactoryC Add MyServer] Default] # inspect commandline-argument for the "factory" to choose... and create a object set fct [MqFactoryC GetCalledL $args] set srv [$fct New] try { $srv LinkCreate $args $srv ProcessEvent MQ_WAIT_FOREVER } on error {} { $srv ErrorCatch } finally { $srv Exit } }
|
static |
Tcl:
→ C-API $ctx ServiceCreate token:string[4] callback:callable
create a link between a service-token and a service-callback …
Definition at line 3065 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API $ctx ServiceDelete token:string[4]
delete a service. …
Definition at line 3084 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API bool [$ctx ServiceIsTransaction]
check if the ongoing-service-call belongs to a transaction …
Definition at line 3100 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API $ctx ServiceProxy token:string[4] ?id:MqSlaveE|int32=MQ_SLAVE_OTHER?
create a service to link a master-context with a slave-context. …
Definition at line 3113 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API $ctx ServiceProxyCtx token:string[4] target:MqContextC
same as MqServiceProxy but use an MqContextC as input.
Definition at line 3131 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API bool [$ctx ServiceProxyCtxExists token:string[4] target:MqContextC]
check if service who belongs to token is a proxy-service
Definition at line 3149 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API $ctx ServiceProxyRoundRobin token:string[4] ident:string
create a proxy-service using Round-Robin as load-balancer …
Definition at line 3166 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API $ctx ServiceStorage token:string[4]
setup a service listen on a MqContextC_ServiceApi_Identifer and save all read-data-package into the STORAGE …
Definition at line 3184 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API bool [$ctx ServiceTokenCheck token:string[4]]
in an ongoing-service-call check if the current MqContextC_ServiceApi_Identifer is token …
Definition at line 3200 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API bool [$ctx ServiceTokenExists token:string[4]]
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
Definition at line 3215 of file MqContextC_tcl.c.
|
static |
Tcl:
→ C-API string[4] [$ctx ServiceTokenGet]
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer …
Definition at line 3230 of file MqContextC_tcl.c.