Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
779 stars 144 forks source link

Queues not added as subscriptions to topic if specified separately #208

Closed JorgenSmith closed 4 years ago

JorgenSmith commented 4 years ago

Hey, first of all, thanks for the great work. I discovered an issue which broke my local config in an update to one of the latest versions: If a queue is specified separately, it will not be added as a subscription. Is this intended behaviour?

Broken config:

Local: 
  Host: goaws.com
  Port: 4100
  Region: us-east-1
  AccountId: "100010001000"
  LogToFile: false
  LogFile: /var/log/goaws_messages.log
  QueueAttributeDefaults:
    VisibilityTimeout: 30
    ReceiveMessageWaitTimeSeconds: 0
  Queues: 
    - Name: local-queue1
  Topics:
    - Name: local-topic1
      Subscriptions:
        - QueueName: local-queue1
          Raw: false

Result:

docker-compose restart aws-snssqs; aws --endpoint-url http://localhost:4100 sns list-subscriptions                                                                               
Restarting aws-snssqs ... done         
{
    "Subscriptions": []
}

Removing the subscriptions part works, however. Working config:

Local: 
  Host: goaws.com
  Port: 4100
  Region: us-east-1
  AccountId: "100010001000"
  LogToFile: false
  LogFile: /var/log/goaws_messages.log
  QueueAttributeDefaults:
    VisibilityTimeout: 30
    ReceiveMessageWaitTimeSeconds: 0
  Topics:
    - Name: local-topic1
      Subscriptions:
        - QueueName: local-queue1

Result (after another restart as per above):

{
    "Subscriptions": [
        {
            "SubscriptionArn": "arn:aws:sns:us-east-1:100010001000:local-topic1:b0997a26-64b2-47a4-8658-9adaae6a5c48",
            "Owner": "",
            "Protocol": "sqs",
            "Endpoint": "arn:aws:sqs:us-east-1:100010001000:local-queue1",
            "TopicArn": "arn:aws:sns:us-east-1:100010001000:local-topic1"
        }
    ]
}

The workaround works, however it was nice to list the queues in one place as well as subscribe them to topics, and it could be a breaking change for other users especially if used in docker (compose).

Cheers!

p4tin commented 4 years ago

That should not be the case, I'll check it out today or tomorrow and fix this. Thanks!

p4tin commented 4 years ago

Fixed in v0.3.1

JorgenSmith commented 4 years ago

Thanks very much for the quick turnaround, @p4tin - I have just confirmed that this fixes the issue. Cheers!