LMIIndicationListener

class lmi.shell.LMIIndicationListener.LMIIndicationListener(hostname, port, certfile=None, keyfile=None, trust_store=None)[source]

Class representing indication listener, which provides a unified API for the server startup and shutdown and for registering an indication handler.

Parameters:
  • hostname (str) – bind hostname
  • port (int) – TCP port, where the server should listen for incoming messages
  • certfile (str) – path to certificate file, if SSL used
  • keyfile (str) – path to key file, if SSL used
  • trust_store (str) – path to trust store
add_handler(handler_name_pattern, handler, *args, **kwargs)[source]

Registers a handler into the indication listener. Returns a string, which is used for the indication recognition, when a message arrives.

Parameters:
  • handler_name_pattern (string) – string, which may contain set of “X” characters at the end of the string. The “X” characters will be replaced by random characters and the whole string will form a unique string.
  • handler – callable, which will be executed, when a indication is received
  • args (tuple) – positional arguments for the handler
  • kwargs (dictionary) – keyword arguments for the handler
Returns:

handler unique name

Return type:

string