MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / FMQ

Class FMQ

fastdeploy/inter_communicator/fmq.py:321–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319
320
321class FMQ:
322 _instance = None
323 _context = None
324
325 def __new__(cls, config_path="fmq_config.json"):
326 if cls._instance is None:
327 cls._instance = super().__new__(cls)
328 EndpointManager.load_config()
329
330 # Determine IO threads based on global defaults
331 io_threads = 1
332 if EndpointManager.config.endpoints:
333 # Use max io_threads among all endpoints
334 io_threads = max(ep.io_threads for ep in EndpointManager.config.endpoints.values())
335
336 cls._context = zmq.asyncio.Context(io_threads=io_threads)
337 return cls._instance
338
339 def queue(self, name: str, role="producer") -> Queue:
340 return Queue(self._context, name, role)
341
342 def topic(self, name: str) -> Topic:
343 return Topic(self._context, name)
344
345 async def destroy(self):
346 # Destroy ZeroMQ context
347 self._context.term()

Callers 7

_init_controlMethod · 0.90
__init__Method · 0.90
init_controlMethod · 0.90
FMQFactoryClass · 0.90
setUpMethod · 0.90
producer_taskFunction · 0.90
consumer_taskFunction · 0.90

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.72