Skip to main content

add_consumer

Tell worker(s) to consume from task queue by name.

def add_consumer(
state: object,
queue: string,
exchange: string,
exchange_type: string,
routing_key: string,
**options: dict
) - > dict

Tell worker(s) to consume from task queue by name.

Parameters

NameTypeDescription
stateobjectThe current state object of the worker control instance
queuestringThe name of the task queue to start consuming from
exchangestringThe name of the exchange to bind the queue to
exchange_typestringThe type of exchange (e.g., 'direct', 'topic', 'fanout'); defaults to 'direct' if not specified
routing_keystringThe routing key to use for the queue binding
**optionsdictAdditional keyword arguments passed to the task queue configuration

Returns

TypeDescription
dictA success response dictionary containing a confirmation message including the queue name