Skip to content

Include parse-url support for rabbitmq (amqp://) scheme #48

Open
@timotei-za

Description

@timotei-za

Problem: Singleton base are not supported if rabbitmq broker are used to assimilate the tasks.
Error: Redis URL must specify one of the following schemes (redis://, rediss://, unix://)

If there is another way to use singleton with the rabbitmq broker, I would be very grateful to know. Thanks!

recap: the problem is that when I use rabbitmq as a broker, I can't use Singleton property inside of decorator as a base, because parse_url method doesn't support the rabbitmq system

env.config file:

CELERY_BROKER_HOST=redis://127.0.0.1:6379

tasks.py file:

@app.task(base=Singleton, name="create_or_update_user")
def create_or_update(user_id: str):
    data = async_to_sync(update_or_create_user)(user_id=user_id)

    return data

create_user.py file:

data = create_or_update.apply_async(
       args=[user_id],
       countdown=CELERY_TASKS_COUNTDOWN, 
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions