-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
import asyncio
from pjrpc.client.backend import aio_pika as pjrpc_client
async def main():
client = pjrpc_client.Client('amqp://guest:guest@localhost:5672/v1', 'jsonrpc')
await client.connect()
await client.close()
if __name__ == "__main__":
asyncio.run(main())with 1.6.0, this results in:
File "aio_pika_client-close-test.py", line 9, in main
await client.close()
File "/home/autonoma/flowhub/pjrpc/pjrpc/client/backend/aio_pika.py", line 86, in close
assert self._result_queue is not None, "client is not initialized"
AssertionError: client is not initializedself._result_queue is always none, unless the Client is costructed to use a fixed result_queue like this:
kwargs["result_queue_name"] = "jsonrpc-responses"
kwargs["result_queue_args"] = {
"exclusive": False,
"auto_delete": False,
"durable": True,
"arguments": None,
}
client = xjsonrpc_client.Client(
URL("amqp://guest:guest@localhost:5672/"),
"jsonrpc-requests",
**kwargs,
)But for the majority of uses, a fixed result queue is not needed and a temporary result queue is used for each call (which is easier if you want to run more than one RPC client)
Metadata
Metadata
Assignees
Labels
No labels