broker rpc

This commit is contained in:
mahdavi 2024-07-01 18:27:50 +03:30
parent a033ef54ce
commit 3c5ea1fefa
2 changed files with 7 additions and 7 deletions

View file

@ -103,10 +103,7 @@ def handle_request(requet_bytes, handler):
} }
response = handler(envirnment) response = handler(envirnment)
print(response.content) # print(response.content)
# print(response.data)
print(dir(response))
# print(views.TestApiView().dispatch(request).data)
return response return response
@ -130,7 +127,7 @@ def get_rpc_broker_consumer():
exchange="", exchange="",
routing_key=props.reply_to, routing_key=props.reply_to,
properties=pika.BasicProperties(correlation_id=props.correlation_id), properties=pika.BasicProperties(correlation_id=props.correlation_id),
body=str(response.content), body=response.content,
) )
ch.basic_ack(delivery_tag=method.delivery_tag) ch.basic_ack(delivery_tag=method.delivery_tag)

View file

@ -62,5 +62,8 @@ request = Request(method=method, url=url, json={'key_1': 'requests_lib'})
rpc = RpcClient() rpc = RpcClient()
print(" [x] Requesting ...") print(" [x] Requesting ...")
response = rpc.call(request) for i in range(1000):
print(response) response = rpc.call(request)
# print(response.decode())
# print(type(response.decode()))
print(i)