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 IServerSetup method and finally cleanup with IServerCleanup.
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.py
→ define the service SRV1 on the server-link-setup
import sys from pymqmsgque import * # package-item class MyServer(MqContextC): # factory startup def __init__(self, tmpl=None): self.ConfigSetServerSetup(self.ServerSetup) super().__init__(tmpl) # service to serve all incoming requests for token "HLWO" def MyFirstService(self): self.SendSTART() self.SendSTR(self.ReadSTR() + " World") self.SendRETURN() # define a service as link between the token "HLWO" and the callback "MyFirstService" def ServerSetup(self): self.ServiceCreate("HLWO",self.MyFirstService) # package-main if __name__ == "__main__": # create the "MyServer" factory… and the object srv = MqFactoryC.Add(MyServer).New() try: srv.LinkCreate(sys.argv) srv.ProcessEvent(MqWaitOnEventE.FOREVER) except Exception as ex: srv.ErrorCatch(ex) finally: srv.Exit()
|
static |
Python:
→ C-API ctx.ServiceCreate(token:string[4], callback:callable)
create a link between a service-token and a service-callback …
Definition at line 3010 of file MqContextC_py.c.
|
static |
Python:
→ C-API ctx.ServiceDelete(token:string[4])
delete a service. …
Definition at line 3029 of file MqContextC_py.c.
|
static |
Python:
→ C-API bool ctx.ServiceIsTransaction()
check if the ongoing-service-call belongs to a transaction …
Definition at line 3045 of file MqContextC_py.c.
|
static |
Python:
→ 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 3058 of file MqContextC_py.c.
|
static |
Python:
→ C-API ctx.ServiceProxyCtx(token:string[4], target:MqContextC)
same as MqServiceProxy but use an MqContextC as input.
Definition at line 3076 of file MqContextC_py.c.
|
static |
Python:
→ C-API bool ctx.ServiceProxyCtxExists(token:string[4], target:MqContextC)
check if service who belongs to token is a proxy-service
Definition at line 3094 of file MqContextC_py.c.
|
static |
Python:
→ C-API ctx.ServiceProxyRoundRobin(token:string[4], ident:string)
create a proxy-service using Round-Robin as load-balancer …
Definition at line 3111 of file MqContextC_py.c.
|
static |
Python:
→ 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 3129 of file MqContextC_py.c.
|
static |
Python:
→ 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 3145 of file MqContextC_py.c.
|
static |
Python:
→ C-API bool ctx.ServiceTokenExists(token:string[4])
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
Definition at line 3160 of file MqContextC_py.c.
|
static |
Python:
→ C-API string[4] ctx.ServiceTokenGet()
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer …
Definition at line 3175 of file MqContextC_py.c.