theLink 10.0
Loading...
Searching...
No Matches
MqMsgque_Main_TCL_API

MqMsgque PACKAGE - the package-main is a single piece of code evaluated only once at application startup … More...

+ Collaboration diagram for MqMsgque_Main_TCL_API:

Functions

static OT_ProcRet tclmqmsgque_MqMsgque_Main (OtClass_ARGS)
  Tcl: (static) MqMsgque Main code:... C-API
Main entrypoint - start the application
 

Detailed Description

MqMsgque PACKAGE - the package-main is a single piece of code evaluated only once at application startup …

Example from MyServer.tcl The package-main configure the factory and start the server.

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
  }
}

Example from MyServer.tcl The package-main configure the factory and start the server.

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_MqMsgque_Main()

static OT_ProcRet tclmqmsgque_MqMsgque_Main ( OtClass_ARGS )
static

Tcl: (static) MqMsgque Main code:... C-API
Main entrypoint - start the application

Definition at line 601 of file LibMqMsgque_tcl.c.

602{
604 WNA(1,1,"code")
605
606 if (Tcl_GetVar2Ex(interp,"MQ_STARTUP_IS_THREAD",NULL,TCL_GLOBAL_ONLY) == NULL) {
607 NS(inMain) = true;
608 int ret = Tcl_EvalObjEx (interp, objv[__skip], TCL_EVAL_GLOBAL);
609 NS(inMain) = false;
610 OtErrorCheckLng (ret);
611 }
612 return TCL_OK;
613}
#define WNA(min, max, txt)
#define OtErrorCheckLng(cmd)
#define OT_SETUP_hdl_static
#define NS(n)
if(call==MQ_RET &&highSKIP==highSIZE) goto call
Definition high_lng.h:230