theLink 10.0
Loading...
Searching...
No Matches
MqMsgque_Main_ATL_API

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

+ Collaboration diagram for MqMsgque_Main_ATL_API:

Functions

static OT_ProcRet atlmqmsgque_MqMsgque_Main (OtClass_ARGS)
  Atl: (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.atl The package-main configure the factory and start the server.

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

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

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

static OT_ProcRet atlmqmsgque_MqMsgque_Main ( OtClass_ARGS )
static

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

Definition at line 555 of file LibMqMsgque_atl.c.

556{
558 WNA(1,1,"code")
559
560 if (Tcl_GetVar2Ex(interp,"MQ_STARTUP_IS_THREAD",NULL,TCL_GLOBAL_ONLY) == NULL) {
561 NS(inMain) = true;
562 int ret = Tcl_EvalObjEx (interp, objv[__skip], TCL_EVAL_GLOBAL);
563 NS(inMain) = false;
564 check_LNG (ret) return TCL_ERROR;
565 }
566 return TCL_OK;
567}
#define WNA(min, max, txt)
#define check_LNG(code)
#define OT_SETUP_hdl_static
#define NS(n)
if(call==MQ_RET &&highSKIP==highSIZE) goto call
Definition high_lng.h:230