theLink 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard - theLib
c - tcl - atl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
Callback Signature List

List of all callback defined by jvmqmsgque

The callback must be an instance of a class with the interface jvmqmsgque.MqServiceIF.

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

The callback in an interface using a single virtual function called Callback.

/* LABEL-NO */
package jvmqmsgque;
public interface MqServiceIF {
void Callback (MqContextC ctx);
}
void Callback(MqContextC ctx)

Example from Callback.java using MqServiceCreate with callback

package example;

import jvmkkernel.*;
import jvmqmsgque.*;

// General rules for defining a callback in RUBY
// ---------------------------------------------
// 1.  The callback must be an \e instance of a class with the interface \WNS{MqServiceIF}

final class OtherServerC implements MqServiceIF {
  private String wht = "" ;
  public OtherServerC(String _wht) { wht = _wht; };
  // The "otherInstanceService" require an extra argument, the "cbCtx".
  public void Callback(MqContextC cbCtx) {
    cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-" + wht + "-Other-Instance");
  }
  // The "otherClassService" require an extra argument, the "cbCtx".
  public static class otherClassService implements MqServiceIF {
    public void Callback(MqContextC cbCtx) {
      cbCtx.Send("R", "C", cbCtx.ReadSTR() + "-World-Other-Class");
    }
  }
} 

// package-item
final class Callback extends MqContextC implements MqServiceIF, MqServerSetupIF {
  private OtherServerC otherCtx = new OtherServerC("World")   ; // just for test purpose;

  // factory startup (constructor)
  public Callback(MqContextC tmpl) {
    super(tmpl);
  }

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

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

  // The "ownClassService" require an extra argument, the "cbCtx".
  public static class ownClassService implements MqServiceIF {
    public void Callback(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.
      ServiceCreate("HLW2",new OtherServerC.otherClassService());

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

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

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

  // -------------------------------------------------------------

  // package-main
  public static void main(String[] argv) {
  
    // create the "Callback" factory… and return the initial (top) object
    MqContextC srv = MqFactoryC.Add(Callback.class).New();

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

Callbacks defined by jvmqmsgque

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