示例#1
0
 def get_boundary():
     global BOUNDARY
     if BOUNDARY:
         return BOUNDARY
     from halo_app import bootstrap
     import importlib
     # bootstrap.COMMAND_HANDLERS["z0"] = A0.run_command_class
     for method_id in settings.HANDLER_MAP:
         clazz_type = settings.HANDLER_MAP[method_id]
         clazz = clazz_type["class"]
         type = clazz_type["type"]
         try:
             module_name, class_name = clazz.rsplit(".", 1)
             x = getattr(importlib.import_module(module_name), class_name)
             if type == OPType.COMMAND.value:  # command
                 bootstrap.COMMAND_HANDLERS[method_id] = x.run_command_class
             if type == OPType.QUERY.value:  # query
                 bootstrap.QUERY_HANDLERS[method_id] = x.run_query_class
             if type == OPType.EVENT.value:  # event
                 bootstrap.EVENT_HANDLERS[method_id] = x.run_event_class
         except Exception as e:
             logger.error("config for handler missing: "+str(clazz) +" - "+str(e))
             raise e
     BOUNDARY = bootstrap.bootstrap()
     return BOUNDARY
示例#2
0
def sqlite_boundary(sqlite_session_factory):
    boundray = bootstrap.bootstrap(
        start_orm=True,
        uow=sql_uow.SqlAlchemyUnitOfWork(sqlite_session_factory),
        publish=lambda *args: None,
    )
    yield boundray
    clear_mappers()
示例#3
0
 def __init__(self):
     self.consumer = None
     self.boundary = bootstrap.bootstrap()
示例#4
0
 def __init__(self):
     self.boundary = bootstrap.bootstrap()
示例#5
0
def bootstrap_test_app():
    return bootstrap.bootstrap(
        start_orm=False,
        uow=FakeUnitOfWork(),
        publish=lambda *args: None,
    )