Skip to content

SQS polling without an SNS topic #1547

@pmioulet

Description

@pmioulet

I have a scenario where I want to subscribe one SQS queues to many topics, hence handling the creation of topics and subscriptions externaly to tomadashi.

The doc seems to imply it it possible to set the topic to None. I tried doing this. However if I set the topic to None, none of the messages get passed to the tomodashi function decorated:

@tomodachi.service
class SqsConsumer(tomodachi.Service):

    # tomodachi process name
    name = "sqs_consumer"

    options = {
        "aws_sns_sqs.region_name": get_from_environment("AWS_REGION"),
        "aws_sns_sqs.aws_access_key_id": get_from_environment("AWS_ACCESS_KEY"),
        "aws_sns_sqs.aws_secret_access_key": get_from_environment("AWS_SECRET_KEY"),
    }
    @aws_sns_sqs(topic=None, queue_name=queue_name, competing=True)
    async def new_message(self, data: Any) -> None:
        self._logger.info("Received a payload from SNS")
        ...

I also tried using regex to match all topics with no luck. It looks like there is some kind of a filter using the topic name in the decorator.

Version used is the latest 0.21.8.

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