예제 #1
0
    def _execute_request(self, actuator_instance, json_msg, uuid):
        """Calls perform_request method of an actuator and sends response to
           output channel.
        """
        service_name = json_msg.get("actuator_request_type").\
                            get("service_controller").get("service_name")
        service_request = json_msg.get("actuator_request_type").\
                            get("service_controller").get("service_request")
        service_info = {}
        service_name, result, error = actuator_instance.\
                                                perform_request(json_msg)
        if error:
            self.send_error_response(service_request, service_name, result)
            return

        logger.debug(f"_processMsg, service_name: {service_name}, \
                                                result: {result}")

        service_info["service_name"] = service_name
        service_info.update(result)

        # Create an actuator response and send it out
        response = self._create_actuator_response(service_info)
        service_controller_msg = ServiceControllerMsg(response)
        if uuid is not None:
            service_controller_msg.set_uuid(uuid)
        json_msg = service_controller_msg.getJson()
        self._write_internal_msgQ("EgressProcessor", json_msg)
    def _execute_request(self, actuator_instance, json_msg, uuid):
        """Calls perform_request method of an actuator and sends response to
           output channel.
        """
        service_name, state, substate = \
            actuator_instance.perform_request(json_msg)

        if substate:
            result = f"{state}:{substate}"
        else:
            result = state

        self._log_debug(
            f"_processMsg, service_name: {service_name}, result: {result}")

        # Create an actuator response and send it out
        service_controller_msg = ServiceControllerMsg(service_name, result)
        if uuid is not None:
            service_controller_msg.set_uuid(uuid)
        json_msg = service_controller_msg.getJson()
        self._write_internal_msgQ("RabbitMQegressProcessor", json_msg)