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

List of all callback defined by csmqmsgque

The callback have to be a instance-method, a class-method or an interface

There a two different types of callback:

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

Callback signature

The callback is an interface using a single virtual function called Servive :

public interface MqServiceIF {
void Service(MqContextC ctx);
}

or a MqContextC instance-method :

public delegate void MqServiceICB();

or a MqContextC class-method :

public delegate void MqServiceCCB(MqContextC ctx);

Example from Callback.cs using MqServiceCreate with callback

using System;
using csmqmsgque;

namespace example {
  // General rules for defining a callback in ATL
  // --------------------------------------------
  // 1.  The \e callback have to be a \e instance-method, a \e class-method or an \e interface.

  // attention, the "::OtherServerC" has no "::MqContextC" as "base-class" and require the "MqContextC::" prefix.
  class OtherServerC : MqServiceIF {
    private string wht = "";

    public OtherServerC(string _wht) { wht = _wht; }

    // The "otherInstanceService" require an extra argument, the "cbCtx".
    public void Service (MqContextC cbCtx) {
      cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-" + wht + "-Other-Instance");
    }
    // The "otherClassService" require an extra argument, the "cbCtx".
    public static void otherClassService (MqContextC cbCtx) {
      cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-World-Other-Class");
    }
  };

  class CallbackC : MqContextC, MqServerSetupIF {

    private OtherServerC otherCtx = new OtherServerC("World");

    // factory startup (constructor)
    public CallbackC (MqContextC tmpl=null) : base(tmpl) {
    }

    // The "procService" require an extra argument, the "cbCtx".
    public void procService(MqContextC cbCtx) {
      cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-World-Proc");
    }

    // The "ownInstanceService" require no extra argument.
    void ownInstanceService () {
      Send("R", "C", ReadSTR() + "-World-Own-Instance");
    }

    // The "ownClassService" require an extra argument, the "cbCtx".
    static void ownClassService (MqContextC cbCtx) {
      cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-World-Own-Class");
    }

    // the "serverSetup" defines the test-services
    public void ServerSetup () {
      // 1. The "otherInstanceCallback" require an extra argument, the "otherCtx".
        ServiceCreate("HLW1",otherCtx);

      // 2. The "otherClassCallback" require no extra argument.
        // -> remember: use the *absolute-namespace* for the callback
        ServiceCreate("HLW2",OtherServerC.otherClassService);

      // 3. The "ownInstanceCallback" require no extra argument.
        ServiceCreate("HLW3",ownInstanceService);

      // 4. The "otherClassCallback" require no extra argument.
        ServiceCreate("HLW4",CallbackC.ownClassService);

      // 5. The "procCallback" require NO extra argument
        ServiceCreate("HLW5",procService);
    }

    // package-main
    static void Main(string[] argv) {
  
      // create the "MyServer" factory… and the object
      var srv = MqFactoryCT<CallbackC>.Add().New();

      try {
	srv.LinkCreate(argv);
	srv.ProcessEvent(MqWaitOnEventE.FOREVER);
      } catch (Exception ex) {
        srv.ErrorCatch (ex);
      }
      srv.Exit();
    }
  }
}

Callbacks defined by csmqmsgque

Member MqSendEND_AND_CALLBACK_RT (MK_RT 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
Member MqSendEND_AND_SUB_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_TOK const token, MqServiceCallbackF const fCall, MK_CBP callback, MqDataFreeF fFree, MK_TIME_T timeout)
MqSendEND_AND_SUB
Member MqServiceCreate_RT (MK_RT mkrt, MQ_CTX const ctx, MQ_TOK const token, MqServiceCallbackF const fCall, MK_CBP callback, MqDataFreeF fFree, MkMarkF fMark)
MqServiceCreate
Member MqSetupS::BgError
ConfigApi_MqBgErrorIF
Member MqSetupS::Event
ConfigApi_MqEventIF
Member MqSetupS::ServerCleanup
ConfigApi_MqServerCleanupIF
Member MqSetupS::ServerSetup
ConfigApi_MqServerSetupIF