theLink 10.0
Loading...
Searching...
No Matches
Internal - callback

The callback have to be a Ruby proc or method

+ Collaboration diagram for Internal - callback:

The callback have to be a Ruby proc or method

There a two different types of callback:

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

If the callback is not a instance of the calling context a self object is added as argument.

There are 3 different types of callback :

type code self argument
procedure ... proc-callback yes
class-method ... CLASS.callback yes
instance-method ... INSTANCE.callback yes
1. global or namespace proc
The python-proc require an extra argument, the calling context.
def myCB(self):
...
...
class MyServerMqContextC):
def serverSetup(self):
self.ServiceCreate("MYTO",myCB)
2. class method (static)
The class-method require an extra argument, the calling context.
The callback is a list of TWO items, the CLASS and the class-METHOD
The METHOD can be from the CLASS itself or from a superclass of the CLASS or from an other CLASS
class MySuper {
@staticmethod
def staticCB(self):
...
class MyServer(MqContextC):
def serverSetup(self):
self.ServiceCreate("MYTO",MySuper.staticCB)
3. own instance method (dynamic)
The own-instance-method has NO extra argument
class MyServer(MyContextC):
def instanceCB(self):
...
def serverSetup(self):
self.ServiceCreate("MYTO",self.instanceCB)
...
4. other instance method (dynamic)
The instance-method require an extra argument, the calling context.
class MyOther:
def otherCB(otherInstance,ctx);
...
otherInstance = MyOther()
class MyServer(MqContextC):
def serverSetup(self):
self.ServiceCreate("MYTO",otherInstance.myCB)

The ONLY argument of the callback-proc have to be the self object.