################################################################################## ## .___________. ______ __ ______ ______ ## | | / || | / __ \ / __ \ ## `---| |----`| ,----'| | | | | | | | | | ## | | | | | | | | | | | | | | ## | | | `----.| `----.| `--' | | `--' | ## |__| \______||_______| \______/ \______/ ## # [server_example] 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 } } # [server_example]