theLink 10.0
Loading...
Searching...
No Matches
MqContextC_Service_TCL_API

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

+ Collaboration diagram for MqContextC_Service_TCL_API:

Functions

static OT_ProcRet tclmqmsgque_MqContextC_ServiceCreate (MqContextC_ARGS)
  Tcl: $ctx ServiceCreate token:string[4] callback:callable C-API
create a link between a service-token and a service-callback
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceDelete (MqContextC_ARGS)
  Tcl: $ctx ServiceDelete token:string[4] C-API
delete a service. …
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceIsTransaction (MqContextC_ARGS)
  Tcl: bool [$ctx ServiceIsTransaction] C-API
check if the ongoing-service-call belongs to a transaction …
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxy (MqContextC_ARGS)
  Tcl: $ctx ServiceProxy 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 tclmqmsgque_MqContextC_ServiceProxyCtx (MqContextC_ARGS)
  Tcl: $ctx ServiceProxyCtx token:string[4] target:MqContextC C-API
same as MqServiceProxy but use an MqContextC as input.
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxyCtxExists (MqContextC_ARGS)
  Tcl: bool [$ctx ServiceProxyCtxExists token:string[4] target:MqContextC] C-API
check if service who belongs to token is a proxy-service
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxyRoundRobin (MqContextC_ARGS)
  Tcl: $ctx ServiceProxyRoundRobin token:string[4] ident:string C-API
create a proxy-service using Round-Robin as load-balancer …
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceStorage (MqContextC_ARGS)
  Tcl: $ctx ServiceStorage 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 tclmqmsgque_MqContextC_ServiceTokenCheck (MqContextC_ARGS)
  Tcl: bool [$ctx ServiceTokenCheck token:string[4]] C-API
in an ongoing-service-call check if the current MqContextC_ServiceApi_Identifer is token
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceTokenExists (MqContextC_ARGS)
  Tcl: bool [$ctx ServiceTokenExists token:string[4]] C-API
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
 
static OT_ProcRet tclmqmsgque_MqContextC_ServiceTokenGet (MqContextC_ARGS)
  Tcl: string[4] [$ctx ServiceTokenGet] 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.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
  }
}

Function Documentation

◆ tclmqmsgque_MqContextC_ServiceCreate()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceCreate ( MqContextC_ARGS )
static

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

Definition at line 3065 of file MqContextC_tcl.c.

3065 {
3068 MQ_TOK token = 0;
3070 OT_SETUP_CALLABLE(callback)
3073 MkErrorC_Check(hdl,MqServiceCreate (hdl, token, NS(ServiceCall), callback, NS(ServiceFree), NULL));
3075 goto end;
3076 error:
3078 end:
3079 OT_CLEANUP_CALLABLE(callback)
3081}
#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)

◆ tclmqmsgque_MqContextC_ServiceDelete()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceDelete ( MqContextC_ARGS )
static

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

Definition at line 3084 of file MqContextC_tcl.c.

3084 {
3087 MQ_TOK token = 0;
3092 goto end;
3093 error:
3095 end:
3097}
#define OT_SETUP_ONEARG(d)
#define ServiceDelete_doc
#define MqServiceDelete(...)

◆ tclmqmsgque_MqContextC_ServiceIsTransaction()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceIsTransaction ( MqContextC_ARGS )
static

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

Definition at line 3100 of file MqContextC_tcl.c.

3100 {
3105 goto end;
3106 error:
3108 end:
3110}
#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 …

◆ tclmqmsgque_MqContextC_ServiceProxy()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxy ( MqContextC_ARGS )
static

Tcl: $ctx ServiceProxy 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 3113 of file MqContextC_tcl.c.

3113 {
3116 MQ_TOK token = 0;
3121 MkErrorC_Check(hdl,MqServiceProxy (hdl, token, id));
3123 goto end;
3124 error:
3126 end:
3128}
#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)

◆ tclmqmsgque_MqContextC_ServiceProxyCtx()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxyCtx ( MqContextC_ARGS )
static

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

Definition at line 3131 of file MqContextC_tcl.c.

3131 {
3134 MQ_TOK token = 0;
3136 MQ_CTX target = 0;
3139 MkErrorC_Check(hdl,MqServiceProxyCtx (hdl, token, target));
3141 goto end;
3142 error:
3144 end:
3146}
#define ServiceProxyCtx_doc
#define MK_NULL_NO
#define MqServiceProxyCtx(...)
#define OT_CHECK_CTX(val, nullB)
PUBLIC data structure for the tclmqmsgque-specific-data

◆ tclmqmsgque_MqContextC_ServiceProxyCtxExists()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxyCtxExists ( MqContextC_ARGS )
static

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

Definition at line 3149 of file MqContextC_tcl.c.

3149 {
3152 MQ_TOK token = 0;
3154 MQ_CTX target = 0;
3158 goto end;
3159 error:
3161 end:
3163}
#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

◆ tclmqmsgque_MqContextC_ServiceProxyRoundRobin()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceProxyRoundRobin ( MqContextC_ARGS )
static

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

Definition at line 3166 of file MqContextC_tcl.c.

3166 {
3169 MQ_TOK token = 0;
3171 MK_STRN ident = 0;
3176 goto end;
3177 error:
3179 end:
3181}
#define ServiceProxyRoundRobin_doc
const MK_STRB * MK_STRN
#define MqServiceProxyRoundRobin(...)

◆ tclmqmsgque_MqContextC_ServiceStorage()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceStorage ( MqContextC_ARGS )
static

Tcl: $ctx ServiceStorage 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 3184 of file MqContextC_tcl.c.

3184 {
3187 MQ_TOK token = 0;
3192 goto end;
3193 error:
3195 end:
3197}
#define ServiceStorage_doc
#define MqServiceStorage(...)

◆ tclmqmsgque_MqContextC_ServiceTokenCheck()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceTokenCheck ( MqContextC_ARGS )
static

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

Definition at line 3200 of file MqContextC_tcl.c.

3200 {
3203 MQ_TOK token = 0;
3207 goto end;
3208 error:
3210 end:
3212}
#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 …

◆ tclmqmsgque_MqContextC_ServiceTokenExists()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceTokenExists ( MqContextC_ARGS )
static

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

Definition at line 3215 of file MqContextC_tcl.c.

3215 {
3218 MQ_TOK token = 0;
3222 goto end;
3223 error:
3225 end:
3227}
#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 …

◆ tclmqmsgque_MqContextC_ServiceTokenGet()

static OT_ProcRet tclmqmsgque_MqContextC_ServiceTokenGet ( MqContextC_ARGS )
static

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

Definition at line 3230 of file MqContextC_tcl.c.

3230 {
3235 goto end;
3236 error:
3238 end:
3240}
#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 …