Skip to main content

move

Find tasks by filtering them and move the tasks to a new queue.

def move(
predicate: Callable,
connection: kombu.Connection = None,
exchange: Union[str, kombu.Exchange] = None,
routing_key: str = None,
source: List[Union[str, kombu.Queue]] = None,
app: Celery = None,
callback: Callable = None,
limit: int = None,
transform: Callable = None,
**kwargs: dict
) - > Any

Find tasks by filtering them and move the tasks to a new queue.

Parameters

NameTypeDescription
predicateCallableFilter function used to decide the messages to move; must accept (body, message) and return a destination (Queue, tuple, or boolean).
connectionkombu.Connection = NoneCustom Kombu connection instance to use for the migration operation instead of acquiring one from the pool.
exchangeUnion[str, kombu.Exchange] = NoneThe default destination exchange name or object where filtered tasks should be republished.
routing_keystr = NoneThe default routing key to use when republishing filtered tasks to the destination exchange.
sourceList[Union[str, kombu.Queue]] = NoneOptional list of source queue names or Queue instances to consume from; defaults to the application's configured task queues.
appCelery = NoneThe Celery application instance to use for configuration and connection management.
callbackCallable = NoneOptional function called after each successful message move, receiving (state, body, message) as arguments.
limitint = NoneThe maximum number of messages to move before stopping the filtering process.
transformCallable = NoneOptional function to modify the destination value returned by the predicate before the task is republished.
**kwargsdictAdditional keyword arguments passed directly to the underlying start_filter function.

Returns

TypeDescription
AnyThe result of the underlying filter operation, typically indicating completion or the state of the message processing loop.