Skip to content

Invalid queue_name with dot #111

Description

@Qu4tro

Checklist

  • [✓] Does your title concisely summarize the problem?
  • [✓] Did you include a minimal, reproducible example?
  • What OS are you using?
  • [✓] What version of Dramatiq are you using?
  • [✓] What did you do?
  • [✓] What did you expect would happen?
  • [✓] What happened?

What version of Dramatiq are you using?

1.3.0

What did you do?

Used the queue_name param in actor.

What did you expect would happen?

It would run without exceptions

What happened?

ValueError: Queue names must start with a letter or an underscore followed by any number of letters, digits, dashes or underscores.

Example code

import dramatiq
import requests
import sys


@dramatiq.actor(queue_name='a.fifo')
def count_words(url):
    response = requests.get(url)
    count = len(response.text.split(" "))
    print(f"There are {count} words at {url!r}.")


if __name__ == "__main__":
    count_words.send(sys.argv[1])

I've looked and found the culprit here (A regex expression to check the queue name):
https://github.com/Bogdanp/dramatiq/blob/master/dramatiq/actor.py#L26

Is there a reason on why it doesn't allow dots? Dots are needed when using fifo queues on AWS SQS. This error message appears otherwise:
Your queue name "a" contains invalid characters. A FIFO queue name must end with the .fifo suffix.

Could the solution be just changing the regex or is there a reason why dots are not permitted?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions