List of all callback defined by CcMqMsgque
The callback have to be a interface, instance-callback or class-callback.
There a two different types of callback:
ctx.ConfigSetServerSetup(MqServerSetupICB MqServerSetupCCB MqServerSetupIF* callback = NULL)
ctx.ConfigSetServerCleanup(MqServerCleanupICB MqServerCleanupCCB MqServerCleanupIF* callback = NULL)
ctx.ConfigSetBgError(MqBgErrorICB MqBgErrorCCB MqBgErrorIF* callback = NULL)
ctx.ConfigSetEvent(MqEventICB MqEventCCB MqEventIF* callback = NULL)
ctx.ServiceCreate(MQ_TOK token, MqServiceICB MqServiceCCB MqServiceIF* callback)
ctx.SendEND_AND_CALLBACK(MQ_TOK token, MqServiceICB MqServiceCCB MqServiceIF* callback, MK_TIME_T timeout = MK_TIMEOUT_DEFAULT)
ctx.SendEND_AND_SUB(MQ_TOK token, MqServiceICB MqServiceCCB MqServiceIF* callback, MK_TIME_T timeout = MK_TIMEOUT_DEFAULT)
The callback is implemented as:
type | code | example |
---|---|---|
interface | ccmqmsgque::IService | Filter4 |
instance-callback | ccmqmsgque::MqContextC::MqTokenICB | manfilter |
class-callback | ccmqmsgque::MqContextC::MqTokenCCB | Filter6 |
Using the signature:
Example from MyServer.cc
→ using MqServiceCreate with callback ccmqmsgque::MqContextC::MqServiceICB
#include "LibMqMsgque_cc.hh" using namespace ccmqmsgque; // package-item class MyServer : public MqContextC, public IServerSetup { friend class MqFactoryCT<MyServer>; private: // define the factory constructor MyServer(MK_TYP const typ, MqContextC* tmpl=NULL) : MqContextC(typ,tmpl) {}; private: // service to serve all incoming requests for token "HLWO" void MyFirstService () { SendSTART(); SendV("%s World", ReadSTR()); SendRETURN(); } // define a service as link between the token "HLWO" and the callback "MyFirstService" void ServerSetup() { ServiceCreate("HLWO", MqServiceICB(&MyServer::MyFirstService)); } }; // package-main int MK_CDECL main(int argc, MK_STRN argv[]) { MqMsgque::Setup(); // setup commandline arguments for later use MkBufferListC largs = {argc, argv}; // create "MyServer" factory… and make it to the default. MqFactoryCT<MyServer>::Add("MyServer")->Default(); // inspect commandline-argument for the "factory" to choose… and create a object auto srv = MqFactoryCT<MqContextC>::GetCalled(largs)->New(); // start listen for incoming call's try { srv->LinkCreate(largs); srv->ProcessEvent (MQ_WAIT_FOREVER); } catch (const std::exception& e) { srv->ErrorCatch(e); } srv->Exit(); }