MqMsgque PACKAGE - the package-main is a single piece of code evaluated only once at application startup …
MqMsgque PACKAGE - the package-main is a single piece of code evaluated only once at application startup …
Example from MyServer.cs
→ The package-main configure the factory and start the server.
using System; using csmqmsgque; namespace example { // package-item sealed class MyServer : MqContextC, MqServerSetupIF { // factory constructor public MyServer(MqContextC tmpl=null) : base(tmpl) { } // service to serve all incoming requests for token "HLWO" public void MyFirstService () { SendSTART(); SendSTR("Hello World"); SendRETURN(); } // define a service as link between the token "HLWO" and the callback "MyFirstService" void MqServerSetupIF.ServerSetup() { ServiceCreate("HLWO", MyFirstService); } // package-main static void Main(string[] argv) { // create the "MyServer" factory… and the object var srv = MqFactoryCT<MyServer>.Add().New(); try { srv.LinkCreate(argv); srv.ProcessEvent(MqWaitOnEventE.FOREVER); } catch (Exception ex) { srv.ErrorCatch (ex); } srv.Exit(); } } }