import logging

LOG = logging.getLogger(__name__)

class WorkflowHistorianMessageHandler(object):
    def __init__(self, broker=None, storage=None, queue_name=None):
        self.broker = broker
        self.storage = storage
        self.queue_name = queue_name

    def __call__(self, message):
        message_dict = message.to_dict()
        LOG.info("Updating [net_key='%s', operation_id='%s']: %r",
                message.net_key, message.operation_id, message_dict)
        self.storage.update(message_dict)


from flow_workflow.historian.messages import UpdateMessage

import logging

LOG = logging.getLogger(__name__)

class WorkflowHistorianMessageHandler(object):
    message_class = UpdateMessage

    def __init__(self, broker=None, storage=None, queue_name=None):
        self.broker = broker
        self.storage = storage
        self.queue_name = queue_name

    def __call__(self, message):
        message_dict = message.to_dict()
        LOG.info("Updating [net_key='%s', operation_id='%s']: %r",
                message.net_key, message.operation_id, message_dict)
        self.storage.update(message_dict)


update historian handler to know its message class