aio-pika
aio-pika copied to clipboard
should I make a hard connection in my app?
I see the doc, I know the connection class is the beginning of the aio-pika. but I don't know if the connection is designed to be a reuseable one?
could I make a connection and reuse it anywhere like this ?
class publisher:
_instance=None
def __new__(cls):
if not cls._instance:
cls._instance=super().__new__(cls)
return cls._instance
async def initialize(url):
self.__connection=aio-pika.connect(url)
@property
def connection():
return self.__connection