Exemplo n.º 1
0
    def on_message(self, body, message):
        response = process_request_message(body)

        if response is not None:
            response_prod = AuthResponseProducer(self.connection, auth_response_exchange)
            response_prod.put_message({'response': response, 'message_id': body['message_id']},
                                      auth_response_queue)
        message.ack()
Exemplo n.º 2
0
def run_server():
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_socket.bind(('127.0.0.1', 5002))
    server_socket.listen(5)
    while True:
        # single threaded for simplicity
        conn, addr = server_socket.accept()
        message = recv_json_message(conn)
        response = process_request_message(message)
        send_json_message(conn, response)
Exemplo n.º 3
0
def run_server():
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_socket.bind(('127.0.0.1', 5002))
    server_socket.listen(5)
    while True:
        # single threaded for simplicity
        conn, addr = server_socket.accept()
        message = recv_json_message(conn)
        response = process_request_message(message)
        send_json_message(conn, response)
Exemplo n.º 4
0
    def on_message(self, body, message):
        response = process_request_message(body)

        if response is not None:
            response_prod = AuthResponseProducer(self.connection,
                                                 auth_response_exchange)
            response_prod.put_message(
                {
                    'response': response,
                    'message_id': body['message_id']
                }, auth_response_queue)
        message.ack()