![]() Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.17.0 to 5.18.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v5.17.0...v5.18.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-core dependency-version: 5.18.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
.mvn/wrapper | ||
src | ||
mvnw | ||
mvnw.cmd | ||
pom.xml | ||
pull-source-files.bat | ||
README.md |
Java code for RabbitMQ tutorials
Here you can find the Java code examples from RabbitMQ tutorials.
To successfully use the examples you will need a RabbitMQ node running locally.
You can easily set this up by installing RabbitMQ.
Requirements
Linux
- Note the source files are symbolic links to the java directory.
Windows
- Run pull-source-files.bat to replace symbolic link to the actual source file.
./pull-source-files.bat
Code
Tutorial one: "Hello World!":
# terminal tab 1
./mvnw compile exec:java -D"exec.mainClass=Recv"
# terminal tab 2
./mvnw compile exec:java -D"exec.mainClass=Send"
Tutorial two: Work Queues:
# terminal tab 1
./mvnw compile exec:java -D"exec.mainClass=Worker"
# terminal tab 2
./mvnw compile exec:java -D"exec.mainClass=Worker"
# terminal tab 3
./mvnw compile exec:java -D"exec.mainClass=NewTask" -D"exec.args='First Message'"
./mvnw compile exec:java -D"exec.mainClass=NewTask" -D"exec.args='Second Message'"
./mvnw compile exec:java -D"exec.mainClass=NewTask" -D"exec.args='Third Message'"
./mvnw compile exec:java -D"exec.mainClass=NewTask" -D"exec.args='Fourth Message'"
./mvnw compile exec:java -D"exec.mainClass=NewTask" -D"exec.args='Fifth Message'"
Tutorial three: Publish/Subscribe
# terminal tab 1
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogs"
# terminal tab 2
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogs"
# terminal tab 3
./mvnw compile exec:java -D"exec.mainClass=EmitLog"
Tutorial four: Routing
# terminal tab 1
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsDirect" -D"exec.args=warning error"
# terminal tab 2
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsDirect" -D"exec.args=info warning error"
# terminal tab 3
./mvnw compile exec:java -D"exec.mainClass=EmitLogDirect" -D"exec.args=info 'Run. Run. Or it will explode'"
./mvnw compile exec:java -D"exec.mainClass=EmitLogDirect" -D"exec.args=warning 'Run. Run. Or it will explode'"
./mvnw compile exec:java -D"exec.mainClass=EmitLogDirect" -D"exec.args=error 'Run. Run. Or it will explode'"
Tutorial five: Topics
# terminal tab 1
# To receive all the logs:
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsTopic" -D"exec.args=#"
# To receive all logs from the facility "kern":
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsTopic" -D"exec.args=kern.*"
# Or if you want to hear only about "critical" logs:
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsTopic" -D"exec.args=*.critical"
# You can create multiple bindings:
./mvnw compile exec:java -D"exec.mainClass=ReceiveLogsTopic" -D"exec.args=kern.* *.critical"
# terminal tab 2
# And to emit a log with a routing key "kern.critical" type:
./mvnw compile exec:java -D"exec.mainClass=EmitLogTopic" -D"exec.args=kern.critical A critical kernel error"
Tutorial six: RPC
# terminal tab 1
# Our RPC service is now ready. We can start the server:
./mvnw compile exec:java -D"exec.mainClass=RPCServer"
# terminal tab 2
# To request a fibonacci number run the client:
./mvnw compile exec:java -D"exec.mainClass=RPCClient"
Tutorial seven: Publisher Confirms
# terminal tab 1
./mvnw compile exec:java -D"exec.mainClass=PublisherConfirms"