(self, message)
This is the function which is called by the manager when a message
        arrives
        The goal of this function is to check if message match filter rules,
        and to call the callback function if it does
This is the function which is called by the manager when a message
        arrives
        The goal of this function is to check if message match filter rules,
        and to call the callback function if it does
This is the function which is called by the manager when a message arrives The goal of this function is to check if message match filter rules and to call the callback function if it does
def new_message(self, message):
        """
        This is the function which is called by the manager when a message
        arrives
        The goal of this function is to check if message match filter rules,
        and to call the callback function if it does
        """
        suffixe = ""
        ok = True
        for key in self._filter:
            suffixe = "%s-%s-%s" % (suffixe, key, self._filter[key])
            if key in message.data:
                if isinstance(self._filter[key], list) and not (message.data[key].lower() in [s.lower() for s in self._filter[key]]):
                    ok = False
                elif not isinstance(self._filter[key], list) and (message.data[key].lower() != self._filter[key].lower()):
                    ok = False
            elif key == "schema":
                ok = ok and (self._filter[key] == message.schema)
            elif key == "xpltype":
                ok = ok and (self._filter[key] == message.type)
            elif key == "xplsource":
                ok = ok and (self._filter[key] == message.source)
            elif key == "xplinstance":
                ok = ok and (self._filter[key] == message.source_instance_id)
            elif not (key in message.data or key in ("xpltype", "schema")):
                ok = False
        #The message match the filter, we can call  the callback function
        if ok:
            self._manager.p.log.debug("Message match for listener {0}".format(self.uuid))
            try:
                if self._cb_params != {} and self._callback.func_code.co_argcount > 1:  
                    thread = threading.Thread(target=self._callback, args = (message, self._cb_params), name="Manager-new-message-cb-%s" % suffixe)
                else:
                    thread = threading.Thread(target=self._callback, args = (message,), name="Manager-new-message-cb-%s" % suffixe)
                self._manager.p.register_thread(thread)
                thread.start()
            except:
                self._manager.p.log.error("Listener exception : %s" % traceback.format_exc())
def new_message ( self , message ) : suffixe = "" ok = True for key in self . _filter : suffixe = "%s-%s-%s" % ( suffixe , key , self . _filter [ key ] ) if key in message . data : if isinstance ( self . _filter [ key ] , list ) and not ( message . data [ key ] . lower ( ) in [ s . lower ( ) for s in self . _filter [ key ] ] ) : ok = False elif not isinstance ( self . _filter [ key ] , list ) and ( message . data [ key ] . lower ( ) != self . _filter [ key ] . lower ( ) ) : ok = False elif key == "schema" : ok = ok and ( self . _filter [ key ] == message . schema ) elif key == "xpltype" : ok = ok and ( self . _filter [ key ] == message . type ) elif key == "xplsource" : ok = ok and ( self . _filter [ key ] == message . source ) elif key == "xplinstance" : ok = ok and ( self . _filter [ key ] == message . source_instance_id ) elif not ( key in message . data or key in ( "xpltype" , "schema" ) ) : ok = False #The message match the filter, we can call  the callback function if ok : self . _manager . p . log . debug ( "Message match for listener {0}" . format ( self . uuid ) ) try : if self . _cb_params != { } and self . _callback . func_code . co_argcount > 1 : thread = threading . Thread ( target = self . _callback , args = ( message , self . _cb_params ) , name = "Manager-new-message-cb-%s" % suffixe ) else : thread = threading . Thread ( target = self . _callback , args = ( message , ) , name = "Manager-new-message-cb-%s" % suffixe ) self . _manager . p . register_thread ( thread ) thread . start ( ) except : self . _manager . p . log . error ( "Listener exception : %s" % traceback . format_exc ( ) )