theLink 10.0
Loading...
Searching...
No Matches
MqContextC_Service_ATL_API

MqContextC - create and manage a service … More...

+ Collaboration diagram for MqContextC_Service_ATL_API:

Functions

static OT_ProcRet atlmqmsgque_MqContextC_ServiceCreate (MqContextC_ARGS)
  Atl: MqContextC::ServiceCreate $ctx token:string[4] callback:callable C-API
create a link between a service-token and a service-callback
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceDelete (MqContextC_ARGS)
  Atl: MqContextC::ServiceDelete $ctx token:string[4] C-API
delete a service. …
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceIsTransaction (MqContextC_ARGS)
  Atl: bool [MqContextC::ServiceIsTransaction $ctx] C-API
check if the ongoing-service-call belongs to a transaction …
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxy (MqContextC_ARGS)
  Atl: MqContextC::ServiceProxy $ctx token:string[4] ?id:MqSlaveE|int32=MQ_SLAVE_OTHER? C-API
create a service to link a master-context with a slave-context. …
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyCtx (MqContextC_ARGS)
  Atl: MqContextC::ServiceProxyCtx $ctx token:string[4] target:MqContextC C-API
same as MqServiceProxy but use an MqContextC as input.
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyCtxExists (MqContextC_ARGS)
  Atl: bool [MqContextC::ServiceProxyCtxExists $ctx token:string[4] target:MqContextC] C-API
check if service who belongs to token is a proxy-service
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyRoundRobin (MqContextC_ARGS)
  Atl: MqContextC::ServiceProxyRoundRobin $ctx token:string[4] ident:string C-API
create a proxy-service using Round-Robin as load-balancer …
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceStorage (MqContextC_ARGS)
  Atl: MqContextC::ServiceStorage $ctx token:string[4] C-API
setup a service listen on a MqContextC_ServiceApi_Identifer and save all read-data-package into the STORAGE
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenCheck (MqContextC_ARGS)
  Atl: bool [MqContextC::ServiceTokenCheck $ctx token:string[4]] C-API
in an ongoing-service-call check if the current MqContextC_ServiceApi_Identifer is token
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenExists (MqContextC_ARGS)
  Atl: bool [MqContextC::ServiceTokenExists $ctx token:string[4]] C-API
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
 
static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenGet (MqContextC_ARGS)
  Atl: string[4] [MqContextC::ServiceTokenGet $ctx] C-API
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer
 

Detailed Description

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

To receive a data-package on a service the event-loop have to be active. The event-loop ia always active on an synchronous-service-call . On a server the event-loop is started with MqProcessEvent at startup.
synchronous-service-call
A synchronous-service-call always block and enter the event-loop to wait for an answer
asynchronous-service-call
A asynchronous-service-call always return immediately and the possible result is received on a callback

callback

A callback is the function called by a service and required to receive data from remote.
A callback is created with MqServiceCreate or is part of the service-call.
A callback can be a service-identifer or a service-callback.
service-call with callback
SendEND_AND_CALLBACK, SendEND_AND_SUB, SendEND_AND_TRANSACTION
service-call without callback
SendEND, SendEND_AND_WAIT

Example from MyServer.atl define the service HLWO on the server-link-setup

package require lib_85
package require atlmqmsgque

# package-item
::myooX::ClassN ::MyServer {
  SuperI ::MqContextC

  # service to serve all incoming requests for token "HLWO"
  proc myFirstService {myNs} {
    SendSTART $myNs
    SendSTR $myNs "[ReadSTR $myNs] World"
    SendRETURN $myNs
  }

  # define a service as link between the token "HLWO" and the callback "MyFirstService"
  proc serverSetup {myNs} {
    ServiceCreate $myNs "HLWO" myFirstService
  }

  # factory startup (constructor)
  proc MyServer {myNs {tmpl ""}} {
    MqContextC $myNs $tmpl
    ConfigSetServerSetup $myNs serverSetup
  }
} 

# package-main
MqMsgque::Main {

  # setup commandline arguments for later use
  set args  [MkBufferListC::CreateLA {*}$argv]

  # create "MyServer" factory... and make it to the default.
  set fct   [MqFactoryC::Default [MqFactoryC::Add ::MyServer]]

  # inspect commandline-argument for the "factory" to choose... and create a object
  set fct   [MqFactoryC::GetCalledL $args]
  set srv   [MqFactoryC::New $fct]

  try {
    MqContextC::LinkCreate $srv $args
    MqContextC::ProcessEvent $srv MQ_WAIT_FOREVER
  } on error {} {
    MqContextC::ErrorCatch $srv
  } finally {
    MqContextC::Exit $srv
  }
}

Function Documentation

◆ atlmqmsgque_MqContextC_ServiceCreate()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceCreate ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceCreate $ctx token:string[4] callback:callable C-API
create a link between a service-token and a service-callback

Definition at line 3043 of file MqContextC_atl.c.

3043 {
3046 MQ_TOK token = 0;
3048 OT_SETUP_CALLABLE(callback)
3051 MkErrorC_Check(hdl,MqServiceCreate (hdl, token, NS(ServiceCall), callback, NS(ServiceFree), NULL));
3053 goto end;
3054 error:
3056 end:
3057 OT_CLEANUP_CALLABLE(callback)
3059}
#define OT_SETUP_VARARGS(min, max, d)
#define OT_retObj_SET_Error
#define OT_CHECK_REQUIRED(val)
#define OT_retObj_SET_None
#define OT_retObj_RETURN
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_CHECK_STRN(val)
#define NS(n)
#define OT_SETUP_hdl
#define ServiceCreate_doc
#define error
Definition high_lng.h:339
#define MqServiceCreate(...)
MK_STRN MQ_TOK
MqContextC - a char[4+1] or hex[8+1] string used to unique identify a service …
MK_STRB token[9]
Definition high_lng.h:229
#define OT_CHECK_CALLABLE(val)
#define OT_CLEANUP_CALLABLE(val)
#define OT_SETUP_CALLABLE(val)

◆ atlmqmsgque_MqContextC_ServiceDelete()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceDelete ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceDelete $ctx token:string[4] C-API
delete a service. …

Definition at line 3062 of file MqContextC_atl.c.

3062 {
3065 MQ_TOK token = 0;
3070 goto end;
3071 error:
3073 end:
3075}
#define OT_SETUP_ONEARG(d)
#define ServiceDelete_doc
#define MqServiceDelete(...)

◆ atlmqmsgque_MqContextC_ServiceIsTransaction()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceIsTransaction ( MqContextC_ARGS )
static

Atl: bool [MqContextC::ServiceIsTransaction $ctx] C-API
check if the ongoing-service-call belongs to a transaction …

Definition at line 3078 of file MqContextC_atl.c.

3078 {
3083 goto end;
3084 error:
3086 end:
3088}
#define OT_retObj_SET_BOL(nat)
#define OT_SETUP_NOARG(d)
#define ServiceIsTransaction_doc
static bool MqServiceIsTransaction(MQ_CTX const ctx)
check if the ongoing-service-call belongs to a transaction …

◆ atlmqmsgque_MqContextC_ServiceProxy()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxy ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceProxy $ctx token:string[4] ?id:MqSlaveE|int32=MQ_SLAVE_OTHER? C-API
create a service to link a master-context with a slave-context. …

Definition at line 3091 of file MqContextC_atl.c.

3091 {
3094 MQ_TOK token = 0;
3099 MkErrorC_Check(hdl,MqServiceProxy (hdl, token, id));
3101 goto end;
3102 error:
3104 end:
3106}
#define OT_CHECK_OPTIONAL(val)
#define ServiceProxy_doc
#define MqServiceProxy(...)
@ MQ_SLAVE_OTHER
internal: on the master-ctx get the slave-ctx and on the slave-ctx get the master-ctx
MK_NUM MQ_SLAVE_ID
a slave identiver
#define OT_CHECK_SLAVE_ID(val)

◆ atlmqmsgque_MqContextC_ServiceProxyCtx()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyCtx ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceProxyCtx $ctx token:string[4] target:MqContextC C-API
same as MqServiceProxy but use an MqContextC as input.

Definition at line 3109 of file MqContextC_atl.c.

3109 {
3112 MQ_TOK token = 0;
3114 MQ_CTX target = 0;
3117 MkErrorC_Check(hdl,MqServiceProxyCtx (hdl, token, target));
3119 goto end;
3120 error:
3122 end:
3124}
#define ServiceProxyCtx_doc
#define MK_NULL_NO
#define MqServiceProxyCtx(...)
#define OT_CHECK_CTX(val, nullB)
PUBLIC data structure for the atlmqmsgque-specific-data

◆ atlmqmsgque_MqContextC_ServiceProxyCtxExists()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyCtxExists ( MqContextC_ARGS )
static

Atl: bool [MqContextC::ServiceProxyCtxExists $ctx token:string[4] target:MqContextC] C-API
check if service who belongs to token is a proxy-service

Definition at line 3127 of file MqContextC_atl.c.

3127 {
3130 MQ_TOK token = 0;
3132 MQ_CTX target = 0;
3136 goto end;
3137 error:
3139 end:
3141}
#define ServiceProxyCtxExists_doc
bool MqServiceProxyCtxExists(MQ_CTX const ctx, MQ_TOK const token, MQ_CTX const target)
check if service who belongs to token is a proxy-service

◆ atlmqmsgque_MqContextC_ServiceProxyRoundRobin()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceProxyRoundRobin ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceProxyRoundRobin $ctx token:string[4] ident:string C-API
create a proxy-service using Round-Robin as load-balancer …

Definition at line 3144 of file MqContextC_atl.c.

3144 {
3147 MQ_TOK token = 0;
3149 MK_STRN ident = 0;
3154 goto end;
3155 error:
3157 end:
3159}
#define ServiceProxyRoundRobin_doc
const MK_STRB * MK_STRN
#define MqServiceProxyRoundRobin(...)

◆ atlmqmsgque_MqContextC_ServiceStorage()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceStorage ( MqContextC_ARGS )
static

Atl: MqContextC::ServiceStorage $ctx token:string[4] C-API
setup a service listen on a MqContextC_ServiceApi_Identifer and save all read-data-package into the STORAGE

Definition at line 3162 of file MqContextC_atl.c.

3162 {
3165 MQ_TOK token = 0;
3170 goto end;
3171 error:
3173 end:
3175}
#define ServiceStorage_doc
#define MqServiceStorage(...)

◆ atlmqmsgque_MqContextC_ServiceTokenCheck()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenCheck ( MqContextC_ARGS )
static

Atl: bool [MqContextC::ServiceTokenCheck $ctx token:string[4]] C-API
in an ongoing-service-call check if the current MqContextC_ServiceApi_Identifer is token

Definition at line 3178 of file MqContextC_atl.c.

3178 {
3181 MQ_TOK token = 0;
3185 goto end;
3186 error:
3188 end:
3190}
#define ServiceTokenCheck_doc
bool MqServiceTokenCheck(MQ_CTX const ctx, MQ_TOK const token)
in an ongoing-service-call check if the current MqContextC_ServiceApi_Identifer is token …

◆ atlmqmsgque_MqContextC_ServiceTokenExists()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenExists ( MqContextC_ARGS )
static

Atl: bool [MqContextC::ServiceTokenExists $ctx token:string[4]] C-API
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …

Definition at line 3193 of file MqContextC_atl.c.

3193 {
3196 MQ_TOK token = 0;
3200 goto end;
3201 error:
3203 end:
3205}
#define ServiceTokenExists_doc
bool MqServiceTokenExists(MQ_CTX const ctx, MQ_TOK const token)
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …

◆ atlmqmsgque_MqContextC_ServiceTokenGet()

static OT_ProcRet atlmqmsgque_MqContextC_ServiceTokenGet ( MqContextC_ARGS )
static

Atl: string[4] [MqContextC::ServiceTokenGet $ctx] C-API
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer

Definition at line 3208 of file MqContextC_atl.c.

3208 {
3213 goto end;
3214 error:
3216 end:
3218}
#define OT_retObj_SET_STR(nat)
#define ServiceTokenGet_doc
MQ_TOK MqServiceTokenGet(MQ_CTX const ctx)
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer …