Example of a Spring Boot worker application for AWS ElasticBeanstalk
Give a quick end-to-end overview on how to implement a worker application for ElasticBeanstalk using Spring Boot.
Use
mvn clean package
to build the application and create a proper .war file in
[PROJECT_DIR]/target/
The easiest way to test the application is to follow the following instruction:
Along with the environment (if you choose the default option in the ElasticBeanstalk configuration, window 'Worker' to auto generate a queue), the environment will create a neq queue for you. Additionally, a DeadLetterQueue is created to collect messages that failed to process.
ElasticBeanstalk also configures all permissions properly for you, hence you don't have to configure anything else then the points described above.
If everything created successfully, go to "Simple Queue Service" in your AWS console and select the newly generated queue. Click in the action menu on 'Send Message' and enter a message JSON. After sending the message, your worker environment will process the message. You can see the logs in your ElasticBeanstalk environment on the tab 'Logs'.
Feel free to contact me on GitHub or on Twitter @bernhard_keprt if you have any questions. Also feel free to give me feedback on the example code, always looking forward to improve something, first of all: myself ;)