getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
912 stars 111 forks source link

How to get a queue link from a another queue? #304

Closed ilyaLibin closed 1 year ago

ilyaLibin commented 1 year ago

Hi, I'm trying to implement a pub/sub using SQS. so basically I send a message event to a main exposed queue (cqrsEvents) that uses some topology map to generate event for each domain

image

So for example for user.deleted event there are several consumers: account, coachTools and analytics.

So the cqrs worker duplicate the received event for 3 other queues. How can I refer through env variables from one queue to other?

    analytics:
        type: queue
        fifo: true
        worker:
            handler: src/domains/analytics/worker.handler
            timeout: 20
        extensions:
            queue:
                Properties:
                    MaximumMessageSize: 262144
    coachTools:
        type: queue
        fifo: true
        worker:
            handler: src/domains/coachTools/worker.handler
            timeout: 20
        extensions:
            queue:
                Properties:
                    MaximumMessageSize: 262144
    account:
        type: queue
        fifo: true
        worker:
            handler: src/domains/account/worker.handler
            timeout: 20
        extensions:
            queue:
                Properties:
                    MaximumMessageSize: 262144
    cqrsEvents:
        type: queue
        fifo: true
        worker:
            handler: src/domains/cqrs.handler
            environment:
               ANALYTICS_QUEUE: ${construct:analytics.queueUrl} <- this doesn't work
               COACH_TOOLS_QUEUE: ${construct:coachTools.queueUrl}  <- this doesn't work
               ACCOUNT_QUEUE: ${construct:account.queueUrl}  <- this doesn't work
            timeout: 20
        extensions:
            queue:
                Properties:
                    MaximumMessageSize: 262144