Does it happen to you that your Spring-boot application uses an Amazon SQS service through spring-cloud-aws-messaging dependency and you depend on an internet connection on your local or development environment? Well, this little dependency tries to supply the same behaviour as Amazon SQS by using in-memory Java Queues and DelayedQueues.
Well, The entry point to send and receive message is QueueMessagingTemplate
, so basically I provide my own version of it.
After that, I needed to add funtionally for the auto-discovery of the annotated consumer methods and bind them to the internal
implementation of java Queues.
Sounded easy right? Take a look at the code, pull-reuests with improvements are welcomed!
Note: If you consider there is something missing, feel free to contact me.
Simple, probably you have already added the spring-cloud-aws-messaging dependency, so you only need to follow these simple steps:
- Add this dependency to your classpath (check How to install)
- After that remember to import its configuration like the following:
import org.springframework.context.annotation.Import;
@Configuration()
@Import(io.github.javiercanillas.amazonws.services.sqs.InMemoryQueueMessagingTemplate)
public class LocalConfiguration {
...
}
- And turn into false the following property:
cloud.aws.sqs.enabled=false
By doing so, your are turning-off the real SQS support.
If you prefer to use maven central releases, you can find it here. Also, if you support Jitpack.io you can find it here