Samples for Spring AMQP
This project hosts some samples that complement Spring AMQP, showing you how to get started with Spring and AMQP.
Install the RabbitMQ broker first (version 2.3.1 or better). Then clone from GIT and then use Maven (2.1.*):
$ git clone ... $ mvn install
SpringSource ToolSuite users (or Eclipse users with the latest m2eclipse plugin) can import the projects as existing Maven projects.
The basic HelloWorld sample has two versions (with synchronous and asynchronous consumers). Both have two Java classes called
Consumerwith main methods to launch. Run the producer first and ensure that the broker is already running.
The Stocks sample has a UI that can be launched as a Java main, and a daemon server process with the same properties. You can run them from an IDE easily. Run the
Serverand then the
Clientand you should see a swing client pop up and stock tickers appearing. To run from the command line you can use the Maven exec plugin:
$ mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=org.springframework.amqp.rabbit.stocks.Server & $ mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=org.springframework.amqp.rabbit.stocks.Client
In the example above we backgrounded the server process, or you could run it in a different window to make things clearer in the console logs.
The Stocks sample is also a web application. You should be able to run it in your IDE, e.g. if you imported the project into STS (or Eclipse with Maven support) you can drag it onto a server, or use
Run As...->On Server. From the command line you can use
$ mvn jetty:run
The web UI is designed like the swing client - it has a ticker table that updates every second (if there is any new data), and an order entry form. The
QuoteControllermanages the interaction between the browser and the application and between the application and the AMQP broker.
Spring Boot versions of the 6 standard RabbitMQ tutorials are provided in
Several Spring Boot applications are also provided, with names
spring-rabbit-.... Explore their individual READMEs for more information.
Here are some ways for you to get involved in the community:
Refer to the spring-amqp Contributor's Guidelines for complete information about the necessary steps.
None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.
eclipse-code-formatter.xmlfrom the root of the project if you are using Eclipse).