|
In Python the message handler has to be a callable entity of any type, including a regular function, that accepts a single parameter of type IncomingMessage
.
An example message handler can be implemented in the following way:
def my_handler(message): # code processing the incoming message ...
and the registration can look like:
my_agent.register_object("my_object", my_handler)
The above approach is used by all example programs, but in more complex systems a typical implementation of the message handler will be encapsulated in the user-provided class with overriden __call__
function.