Spring-cloud-aws: Is there a way to automatically add a prefix to SQS Queue names?

Created on 17 Oct 2017  路  1Comment  路  Source: spring-cloud/spring-cloud-aws

Is there a way to add a prefix to all SQS Queue names using the Java config? I need to be able to support multiple environments in the same AWS accounts, so I need a way to differentiate the queue names, for example if I have queue name new-accounts, I need to be able to prefix so the following two queues could exist in the same account: johns-dev.new-accounts and bills-dev.new-accounts.

I need to do these three operations: Create a Queue, Send a Message and Listen for messages using @SqsListener("{queue-name}"). The first two I could simply join the strings when I do those operations, but the later is an annotation. Also I'd prefer to _not_ have to execute the prefixing logic in multiple places.

question

Most helpful comment

Hi @pluttrell sorry for the late reply. Have a look at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver I think that is the best point for you to extends. So you can use the same "canonical" queue names and have a smart destination resolver to prefix the queue names (and look up the queue names obviously).

Hope this helps, feel free to re-open in case of any further questions.

>All comments

Hi @pluttrell sorry for the late reply. Have a look at org.springframework.cloud.aws.messaging.support.destination.DynamicQueueUrlDestinationResolver I think that is the best point for you to extends. So you can use the same "canonical" queue names and have a smart destination resolver to prefix the queue names (and look up the queue names obviously).

Hope this helps, feel free to re-open in case of any further questions.

Was this page helpful?
0 / 5 - 0 ratings