theLink 10.0
Loading...
Searching...
No Matches
MqContextC_Service_RB_API

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

+ Collaboration diagram for MqContextC_Service_RB_API:

Functions

static OT_ProcRet rbmqmsgque_MqContextC_ServiceCreate (MqContextC_ARGS)
  Ruby: ctx.ServiceCreate(token:string[4], callback:callable) C-API
create a link between a service-token and a service-callback
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceDelete (MqContextC_ARGS)
  Ruby: ctx.ServiceDelete(token:string[4]) C-API
delete a service. …
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceIsTransaction (MqContextC_ARGS)
  Ruby: bool ctx.ServiceIsTransaction() C-API
check if the ongoing-service-call belongs to a transaction …
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxy (MqContextC_ARGS)
  Ruby: 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 rbmqmsgque_MqContextC_ServiceProxyCtx (MqContextC_ARGS)
  Ruby: ctx.ServiceProxyCtx(token:string[4], target:MqContextC) C-API
same as MqServiceProxy but use an MqContextC as input.
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxyCtxExists (MqContextC_ARGS)
  Ruby: bool ctx.ServiceProxyCtxExists(token:string[4], target:MqContextC) C-API
check if service who belongs to token is a proxy-service
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxyRoundRobin (MqContextC_ARGS)
  Ruby: ctx.ServiceProxyRoundRobin(token:string[4], ident:string) C-API
create a proxy-service using Round-Robin as load-balancer …
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceStorage (MqContextC_ARGS)
  Ruby: 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 rbmqmsgque_MqContextC_ServiceTokenCheck (MqContextC_ARGS)
  Ruby: 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 rbmqmsgque_MqContextC_ServiceTokenExists (MqContextC_ARGS)
  Ruby: bool ctx.ServiceTokenExists(token:string[4]) C-API
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …
 
static OT_ProcRet rbmqmsgque_MqContextC_ServiceTokenGet (MqContextC_ARGS)
  Ruby: 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.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

Function Documentation

◆ rbmqmsgque_MqContextC_ServiceCreate()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceCreate ( MqContextC_ARGS )
static

Ruby: ctx.ServiceCreate(token:string[4], callback:callable) C-API
create a link between a service-token and a service-callback

Definition at line 2512 of file MqContextC_rb.c.

2512 {
2515 MQ_TOK token = 0;
2517 OT_SETUP_CALLABLE(callback)
2520 MkErrorC_Check(hdl,MqServiceCreate (hdl, token, NS(ServiceCall), callback, NS(ServiceFree), NS(ProcMark)));
2522 end: MK_UNUSED /* LONG JUMP on error */
2523 OT_CLEANUP_CALLABLE(callback)
2525}
#define OT_SETUP_VARARGS(min, max, d)
#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 MK_UNUSED
#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)

◆ rbmqmsgque_MqContextC_ServiceDelete()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceDelete ( MqContextC_ARGS )
static

Ruby: ctx.ServiceDelete(token:string[4]) C-API
delete a service. …

Definition at line 2528 of file MqContextC_rb.c.

2528 {
2531 MQ_TOK token = 0;
2536 end: MK_UNUSED /* LONG JUMP on error */
2538}
#define OT_SETUP_ONEARG(d)
#define ServiceDelete_doc
#define MqServiceDelete(...)

◆ rbmqmsgque_MqContextC_ServiceIsTransaction()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceIsTransaction ( MqContextC_ARGS )
static

Ruby: bool ctx.ServiceIsTransaction() C-API
check if the ongoing-service-call belongs to a transaction …

Definition at line 2541 of file MqContextC_rb.c.

2541 {
2546 end: MK_UNUSED /* LONG JUMP on error */
2548}
#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 …

◆ rbmqmsgque_MqContextC_ServiceProxy()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxy ( MqContextC_ARGS )
static

Ruby: 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 2551 of file MqContextC_rb.c.

2551 {
2554 MQ_TOK token = 0;
2559 MkErrorC_Check(hdl,MqServiceProxy (hdl, token, id));
2561 end: MK_UNUSED /* LONG JUMP on error */
2563}
#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)

◆ rbmqmsgque_MqContextC_ServiceProxyCtx()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxyCtx ( MqContextC_ARGS )
static

Ruby: ctx.ServiceProxyCtx(token:string[4], target:MqContextC) C-API
same as MqServiceProxy but use an MqContextC as input.

Definition at line 2566 of file MqContextC_rb.c.

2566 {
2569 MQ_TOK token = 0;
2571 MQ_CTX target = 0;
2574 MkErrorC_Check(hdl,MqServiceProxyCtx (hdl, token, target));
2576 end: MK_UNUSED /* LONG JUMP on error */
2578}
#define ServiceProxyCtx_doc
#define MK_NULL_NO
#define MqServiceProxyCtx(...)
#define OT_CHECK_CTX(val, nullB)
PUBLIC data structure for the rbmqmsgque-specific-data

◆ rbmqmsgque_MqContextC_ServiceProxyCtxExists()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxyCtxExists ( MqContextC_ARGS )
static

Ruby: bool ctx.ServiceProxyCtxExists(token:string[4], target:MqContextC) C-API
check if service who belongs to token is a proxy-service

Definition at line 2581 of file MqContextC_rb.c.

2581 {
2584 MQ_TOK token = 0;
2586 MQ_CTX target = 0;
2590 end: MK_UNUSED /* LONG JUMP on error */
2592}
#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

◆ rbmqmsgque_MqContextC_ServiceProxyRoundRobin()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceProxyRoundRobin ( MqContextC_ARGS )
static

Ruby: ctx.ServiceProxyRoundRobin(token:string[4], ident:string) C-API
create a proxy-service using Round-Robin as load-balancer …

Definition at line 2595 of file MqContextC_rb.c.

2595 {
2598 MQ_TOK token = 0;
2600 MK_STRN ident = 0;
2605 end: MK_UNUSED /* LONG JUMP on error */
2607}
#define ServiceProxyRoundRobin_doc
const MK_STRB * MK_STRN
#define MqServiceProxyRoundRobin(...)

◆ rbmqmsgque_MqContextC_ServiceStorage()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceStorage ( MqContextC_ARGS )
static

Ruby: 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 2610 of file MqContextC_rb.c.

2610 {
2613 MQ_TOK token = 0;
2618 end: MK_UNUSED /* LONG JUMP on error */
2620}
#define ServiceStorage_doc
#define MqServiceStorage(...)

◆ rbmqmsgque_MqContextC_ServiceTokenCheck()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceTokenCheck ( MqContextC_ARGS )
static

Ruby: 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 2623 of file MqContextC_rb.c.

2623 {
2626 MQ_TOK token = 0;
2630 end: MK_UNUSED /* LONG JUMP on error */
2632}
#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 …

◆ rbmqmsgque_MqContextC_ServiceTokenExists()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceTokenExists ( MqContextC_ARGS )
static

Ruby: bool ctx.ServiceTokenExists(token:string[4]) C-API
check if the MqContextC_ServiceApi_Identifer token is defined as ctx service …

Definition at line 2635 of file MqContextC_rb.c.

2635 {
2638 MQ_TOK token = 0;
2642 end: MK_UNUSED /* LONG JUMP on error */
2644}
#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 …

◆ rbmqmsgque_MqContextC_ServiceTokenGet()

static OT_ProcRet rbmqmsgque_MqContextC_ServiceTokenGet ( MqContextC_ARGS )
static

Ruby: string[4] ctx.ServiceTokenGet() C-API
in an ongoing-service-call get the current MqContextC_ServiceApi_Identifer

Definition at line 2647 of file MqContextC_rb.c.

2647 {
2652 end: MK_UNUSED /* LONG JUMP on error */
2654}
#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 …