Initialize the queue worker. Args: queue: Async queue implementation to consume from server: Optional server instance to invoke APIs on partition_id: Optional partition ID for partitioned queues. If set, worker will only
(
self,
queue: "QueueInterface",
server: Optional[Any] = None,
partition_id: Optional[int] = None,
)
| 30 | """Background worker that processes messages from the queue as an asyncio.Task""" |
| 31 | |
| 32 | def __init__( |
| 33 | self, |
| 34 | queue: "QueueInterface", |
| 35 | server: Optional[Any] = None, |
| 36 | partition_id: Optional[int] = None, |
| 37 | ): |
| 38 | """ |
| 39 | Initialize the queue worker. |
| 40 | |
| 41 | Args: |
| 42 | queue: Async queue implementation to consume from |
| 43 | server: Optional server instance to invoke APIs on |
| 44 | partition_id: Optional partition ID for partitioned queues. |
| 45 | If set, worker will only consume from this partition. |
| 46 | """ |
| 47 | logger.debug( |
| 48 | "Initializing queue worker: server=%s, partition_id=%s", |
| 49 | "provided" if server else "None", |
| 50 | partition_id, |
| 51 | ) |
| 52 | |
| 53 | self.queue = queue |
| 54 | self._server = server |
| 55 | self._partition_id = partition_id |
| 56 | self._running = False |
| 57 | self._task: Optional[asyncio.Task] = None |
| 58 | |
| 59 | def _convert_proto_user_to_pydantic(self, proto_user) -> "Client": |
| 60 | """ |