Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one queue for multiple tasks #72

Open
felipao-mx opened this issue Jan 29, 2022 · 0 comments
Open

one queue for multiple tasks #72

felipao-mx opened this issue Jan 29, 2022 · 0 comments

Comments

@felipao-mx
Copy link
Member

current implementation requires dedicated queue for each task. It could be a difficult to manage so many queues. So I propose to use a unique queue for many tasks definiton.

current implementation

TASK_1_QUEUE_URL = 'http://127.0.0.1:4000/123456789012/task1.fifo'
TASK_2_QUEUE_URL = 'http://127.0.0.1:4000/123456789012/task2.fifo'


@task(queue_url=TASK_1_QUEUE_URL, region_name='us-east-1')
async def task1(message) -> None:
    print(message)

@task(queue_url=TASK_2_QUEUE_URL, region_name='us-east-1')
async def task2(message) -> None:
    print(message)

proposed

QUEUE_URL = 'http://127.0.0.1:4000/123456789012/my_tasks.fifo'


@task(queue_url=QUEUE_URL, region_name='us-east-1')
async def task1(message) -> None:
    print(message)

@task(queue_url=QUEUE_URL, region_name='us-east-1')
async def task2(message) -> None:
    print(message)

we could distinguish each tasks by using message attributes
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html#SQS.Client.send_message

MessageAttributes={
        'string': {
            'StringValue': 'string',
            'BinaryValue': b'bytes',
            'StringListValues': [
                'string',
            ],
            'BinaryListValues': [
                b'bytes',
            ],
            'DataType': 'string'
        }
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant