MCPcopy Create free account
hub / github.com/dbunt1tled/python-fast-api / initialize

Method initialize

src/core/rabbit_mq/producer.py:27–41  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25 self._is_initialized = False
26
27 async def initialize(self) -> None:
28 if self._is_initialized:
29 return
30
31 try:
32 self._conn = await aio_pika.connect_robust(
33 url=self.config.url,
34 heartbeat=self.config.heartbeat,
35 connection_timeout=self.config.connection_timeout,
36 )
37 self._is_initialized = True
38 self.logger.info("🚀 RabbitMQ producer initialized successfully")
39 except Exception as e:
40 self.logger.error(f"🛑 Failed to initialize RabbitMQ producer: {e}")
41 raise
42
43 async def close(self) -> None:
44 if self._conn and not self._conn.is_closed:

Callers

nothing calls this directly

Calls 2

infoMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected