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.rb
→ define the service HLWO on the server-link-setup
require "rbmqmsgque" include MqMsgque # package-item class MyServer < MqContextC # factory startup def initialize() super ConfigSetServerSetup(method(:ServerSetup)) end # define a service as link between the token "HLWO" and the callback "MyFirstService" def ServerSetup ServiceCreate("HLWO",method(:MyFirstService)) end # service to serve all incoming requests for token "HLWO" def MyFirstService() SendSTART() SendSTR(ReadSTR() + " World") SendRETURN() end end # ==================================================== # package-main # create the "MyServer" factory… and object srv = MqFactoryC.Add(MyServer).New() begin srv.LinkCreate(ARGV) srv.ProcessEvent(MqWaitOnEventE::FOREVER) rescue Exception => ex srv.ErrorCatch(ex) ensure srv.Exit() end
|
static |
Ruby:
→ C-API ctx.ServiceCreate(token:string[4], callback:callable)
create a link between a service-token and a service-callback …
Definition at line 2512 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API ctx.ServiceDelete(token:string[4])
delete a service. …
Definition at line 2528 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API bool ctx.ServiceIsTransaction()
check if the ongoing-service-call belongs to a transaction …
Definition at line 2541 of file MqContextC_rb.c.
|
static |
Ruby:
→ 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 2551 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API ctx.ServiceProxyCtx(token:string[4], target:MqContextC)
same as MqServiceProxy but use an MqContextC as input.
Definition at line 2566 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API bool ctx.ServiceProxyCtxExists(token:string[4], target:MqContextC)
check if service who belongs to token is a proxy-service
Definition at line 2581 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API ctx.ServiceProxyRoundRobin(token:string[4], ident:string)
create a proxy-service using Round-Robin as load-balancer …
Definition at line 2595 of file MqContextC_rb.c.
|
static |
Ruby:
→ 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 2610 of file MqContextC_rb.c.
|
static |
Ruby:
→ 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 2623 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API bool ctx.ServiceTokenExists(token:string[4])
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
Definition at line 2635 of file MqContextC_rb.c.
|
static |
Ruby:
→ C-API string[4] ctx.ServiceTokenGet()
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer …
Definition at line 2647 of file MqContextC_rb.c.