def handle_message(header, payload, context): """Handle the messages submitted to the transaction processor""" if not can_handle_message(payload=payload): raise InvalidTransaction("No handler registered for {}".format( get_message_type_name(payload.message_type))) message_handlers[payload.message_type].apply(header=header, payload=payload, context=context)
def unregister_message_handler(message): """Unregister a transaction message handler for a given message class""" if message.message_type in message_handlers: LOGGER.debug( "removing message handler for %s", get_message_type_name(message.message_type), ) del message_handlers[message.message_type]
def __init__(self): AddressBase.__init__(self) self._message_type_name = batcher.get_message_type_name( self.message_type) if self.register_message: processor.register_message_handler(self) else: processor.unregister_message_handler(self)
def __init__(self): super().__init__() self._message_type_name = batcher.get_message_type_name(self.message_type)