Ejemplo n.º 1
0
def handle_incoming_request(request):
    if request:
        print(
            "Subscriber Received request: Metadata:'%s', Channel:'%s', Body:'%s' tags:%s"
            % (request.metadata, request.channel, request.body, request.tags))

        response = Response(request)
        response.body = "OK".encode('UTF-8')
        response.cache_hit = False
        response.error = "None"
        response.client_id = "My_Client_id"
        response.executed = True
        response.metadata = "OK"
        response.timestamp = datetime.datetime.now()
        response.tags = request.tags
        return response
Ejemplo n.º 2
0
 def send_request(self, request):
     """Publish a single request using the KubeMQ."""
     try:
         inner_request = request.convert()
         inner_response = self.get_kubemq_client().SendRequest(inner_request, self._metadata)
         return Response(inner_response)
     except Exception as e:
         logging.exception("Grpc Exception in send_request:'%s'" % (e))
         raise
Ejemplo n.º 3
0
 def process_response(call):
     handler(Response(call.result()))