def handle(self, request, buffer_size):
        """
        Handle a message
        :param request: the request socket.
        :param buffer_size: the buffer size.
        :return: True if success, False otherwise
        """

        if self.component_type == StreamComponent.SOURCE:
            msg = self.handler_function()
            return self.__send(request, msg)

        logger = self.logger

        data = self.__receive(request, buffer_size)
        if data is None:
            return False
        else:
            logger.debug(data.split(self.TERMINATOR))
            for message in data.split(self.TERMINATOR)[:-1]:
                logger.debug(message)
                result = self.handler_function(message)
                if self.component_type == StreamComponent.PROCESSOR:
                    if not self.__send(request, result):
                        return False
        return True
def handle ( self , request , buffer_size ) : if self . component_type == StreamComponent . SOURCE : msg = self . handler_function ( ) return self . __send ( request , msg ) logger = self . logger data = self . __receive ( request , buffer_size ) if data is None : return False else : logger . debug ( data . split ( self . TERMINATOR ) ) for message in data . split ( self . TERMINATOR ) [ : - 1 ] : logger . debug ( message ) result = self . handler_function ( message ) if self . component_type == StreamComponent . PROCESSOR : if not self . __send ( request , result ) : return False return True
Handle a message
        :param request: the request socket.
        :param buffer_size: the buffer size.
        :return: True if success, False otherwise