示例#1
0
 def run_command(self, method_id, params):
     halo_context = client_util.get_halo_context({},
                                                 client_type=ClientType.cli)
     halo_request = SysUtil.create_command_request(halo_context, method_id,
                                                   params)
     response = self.boundary.execute(halo_request)
     return response.payload
示例#2
0
 def run_query(self, method_id, params):
     halo_context = client_util.get_halo_context({},
                                                 client_type=ClientType.cli)
     t = AbsHaloQuery(halo_context, method_id, params)
     halo_request = SysUtil.create_query_request(t)
     response = self.boundary.execute(halo_request)
     return response.payload
示例#3
0
 def test_for_new_product(self):
     boundray = bootstrap_test_app()
     halo_context = client_util.get_halo_context({})
     halo_request = SysUtil.create_command_request(halo_context, "z0",
                                                   {'id': 1})
     boundray.execute(halo_request)
     assert boundray.uow.products.get("CRUNCHY-ARMCHAIR") is not None
     assert boundray.uow.committed
示例#4
0
 def __init__(self):
     super(Consumer, self).__init__()
     r = redis.Redis(settings.REDIS_URI)
     self.consumer = r.pubsub(ignore_subscribe_messages=True)
     self.consumer.subscribe(settings.HALO_CHANNEL)
     client_util.get_halo_context({}, client_type=ClientType.event)
示例#5
0
 def run_command(self,method_id,params,command_id):
     logger.info('start executing command: %s, id: %s ', method_id, command_id)
     halo_context = client_util.get_halo_context({},client_type=ClientType.event)
     halo_request = SysUtil.create_command_request(halo_context, method_id, params)
     response = self.boundary.execute(halo_request)
     logger.info('executed command: %s, id: %s success: %s', method_id,response.request.command.id,response.success)