AMQP / Kombu task routing, queue configuration, and task message publishing
(ported from celery.app.amqp).
Summary
Functions
Builds a %Kombu.Connection{} for the given %Celery{} or %Celery.Config{}.
Creates a task message (as_task_v2 or as_task_v1) according to the app's task_protocol
setting (or :protocol option).
Returns the default %Kombu.Queue{} configured for the given %Celery{} or %Celery.Config{}.
Returns the list of %Kombu.Queue{} structs for a worker to consume from.
Resolves routing parameters (exchange, routing_key, queue, serializer, compression, delivery_mode, priority)
for a task invocation.
Publishes a prepared task message (%{headers: ..., properties: ..., body: ...})
over Kombu using the configured broker connection.
Functions
@spec build_connection(Celery.t() | Celery.Config.t()) :: Kombu.Connection.t()
Builds a %Kombu.Connection{} for the given %Celery{} or %Celery.Config{}.
@spec create_task_message( Celery.t() | Celery.Config.t(), String.t(), list(), map(), keyword() ) :: Celery.Protocol.task_message()
Creates a task message (as_task_v2 or as_task_v1) according to the app's task_protocol
setting (or :protocol option).
@spec default_queue(Celery.t() | Celery.Config.t()) :: Kombu.Queue.t()
Returns the default %Kombu.Queue{} configured for the given %Celery{} or %Celery.Config{}.
@spec queues_for_worker( Celery.t() | Celery.Config.t(), [String.t() | Kombu.Queue.t()] | nil ) :: [ Kombu.Queue.t() ]
Returns the list of %Kombu.Queue{} structs for a worker to consume from.
@spec resolve_route(Celery.t() | Celery.Config.t(), String.t(), keyword()) :: map()
Resolves routing parameters (exchange, routing_key, queue, serializer, compression, delivery_mode, priority)
for a task invocation.
@spec send_task_message( Celery.t() | Celery.Config.t(), Celery.Protocol.task_message(), keyword() ) :: :ok | {:error, term()}
Publishes a prepared task message (%{headers: ..., properties: ..., body: ...})
over Kombu using the configured broker connection.