Loading...
Searching...
No Matches
Callback Signature List

List of all callback defined by LibMqMsgque

The servive-callback have to be a function-pointer of type MqServiceCallbackF (#MQ_TokenF)

There a two different types of callback:

  1. A callback used to define a context
  2. A callback used to define a service

Callback signature

Callback used to call a service

#define MQ_SERVICE_CALL_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR const __data__
#define MQ_SERVICE_CALL MK_RT_CALL mqctx, __data__

Callback used to free a service

#define MQ_SERVICE_FREE_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP

Callback used to copy a service

#define MQ_SERVICE_COPY_ARGS MK_RT_ARGS MQ_CTX const mqctx, MK_PTR *dataP

Example from MyServer.c using MqServiceCreate with callback MqServiceCallbackF

#include "common.h"

// service to serve all incoming requests for token "HLWO"
static enum MkErrorE MyFirstService ( MQ_SERVICE_CALL_ARGS ) {
  MqSendSTART_E (mqctx);
  MqSendV_E (mqctx, "%s World", MqReadSTR_e(mqctx));
error:
  return MqSendRETURN(mqctx);
}

// define a service as link between the token "HLWO" and the callback "MyFirstService"
static enum MkErrorE ServerSetup ( MQ_SERVICE_CALL_ARGS ) {
  return MqServiceCreate(mqctx,"HLWO", MyFirstService, NULL, NULL, NULL);
}

// package-item
enum MkErrorE
MyServerFactory ( MQ_CALLBACK_FACTORY_CTOR_ARGS )
{ 
  MQ_CTX const mqctx = *contextP = MqContextCreate(NULL,tmpl);
  MqConfigSetServerSetup (mqctx, ServerSetup, NULL, NULL, NULL);
  return MK_OK;
}

// package-main
int main (int argc, MK_STRN argv[]) 
{
  MqRtSetup_NULL;

  // setup commandline arguments for later use
  MK_BFL largv = MkBufferListCreateVC(argc, argv);
  MQ_CTX mqctx = NULL;

  // create "MyServer" factory… and make it to the default.
  MqFactoryDefault( MqFactoryAdd_2(MyServerFactory, "MyServer"));
  // inspect commandline-argument for the "factory" to choose… and create a object
  MqFactoryNew_E (MqFactoryGetCalledL(largv), NULL, &mqctx);

  // start listen for incoming call's
  MqLinkCreate_E (mqctx, largv);
  MqCheckForLeftOverArguments_E (mqctx, largv);
  MqProcessEvent_E (mqctx,MQ_WAIT_FOREVER,MK_TIMEOUT_DEFAULT);
error:
  MkBufferListDelete(largv);
  MqExit_1(mqctx);
}

Callbacks defined by LibMqMsgque

Global MqSendEND_AND_CALLBACK_RT (MK_RT const mkrt, MQ_CTX const ctx, MQ_TOK const token, MqServiceCallbackF const fCall, MK_CBP callback, MqDataFreeF fFree, MK_TIME_T const timeout)
MqSendEND_AND_CALLBACK
Global MqSendEND_AND_SUB_RT (MK_RT const mkrt, MQ_CTX const ctx, MQ_TOK const token, MqServiceCallbackF const fCall, MK_CBP callback, MqDataFreeF fFree, MK_TIME_T timeout)
MqSendEND_AND_SUB
Global MqServiceCreate_RT (MK_RT const mkrt, MQ_CTX const ctx, MQ_TOK const token, MqServiceCallbackF const fCall, MK_CBP callback, MqDataFreeF fFree, MkMarkF fMark)
MqServiceCreate
Global MqSetupS::BgError
ConfigApi_IBgError
Global MqSetupS::Event
ConfigApi_IEvent
Global MqSetupS::ServerCleanup
ConfigApi_IServerCleanup
Global MqSetupS::ServerSetup
ConfigApi_IServerSetup