![]() 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:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
gradle/wrapper | ||
src/main/java | ||
.gitignore | ||
build.gradle | ||
gradlew | ||
gradlew.bat | ||
pull-source-files.bat | ||
README.md | ||
settings.gradle |
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
./gradlew -Pmain=Recv run
# terminal tab 2
./gradlew -Pmain=Send run
Tutorial two: Work Queues:
# terminal tab 1
./gradlew -Pmain=Worker run
# terminal tab 2
./gradlew -Pmain=Worker run
# terminal tab 3
./gradlew -Pmain=NewTask run --args "First Message"
./gradlew -Pmain=NewTask run --args "Second Message"
./gradlew -Pmain=NewTask run --args "Third Message"
./gradlew -Pmain=NewTask run --args "Fourth Message"
./gradlew -Pmain=NewTask run --args "Fifth Message"
Tutorial three: Publish/Subscribe
# terminal tab 1
./gradlew -Pmain=ReceiveLogs run
# terminal tab 2
./gradlew -Pmain=ReceiveLogs run
# terminal tab 3
./gradlew -Pmain=EmitLog run
Tutorial four: Routing
# terminal tab 1
./gradlew -Pmain=ReceiveLogsDirect run --args "warning error"
# terminal tab 2
./gradlew -Pmain=ReceiveLogsDirect run --args "info warning error"
# terminal tab 3
./gradlew -Pmain=EmitLogDirect run --args "info 'Run. Run. Or it will explode'"
./gradlew -Pmain=EmitLogDirect run --args "warning 'Run. Run. Or it will explode'"
./gradlew -Pmain=EmitLogDirect run --args "error 'Run. Run. Or it will explode'"
Tutorial five: Topics
# terminal tab 1
# To receive all the logs:
./gradlew -Pmain=ReceiveLogsTopic run --args "#"
# To receive all logs from the facility "kern":
./gradlew -Pmain=ReceiveLogsTopic run --args "kern.*"
# Or if you want to hear only about "critical" logs:
./gradlew -Pmain=ReceiveLogsTopic run --args "*.critical"
# You can create multiple bindings:
./gradlew -Pmain=ReceiveLogsTopic run --args "kern.* *.critical"
# terminal tab 2
# And to emit a log with a routing key "kern.critical" type:
./gradlew -Pmain=EmitLogTopic run --args "kern.critical A critical kernel error"
Tutorial six: RPC
# terminal tab 1
# Our RPC service is now ready. We can start the server:
./gradlew -Pmain=RPCServer run
# terminal tab 2
# To request a fibonacci number run the client:
./gradlew -Pmain=RPCClient run
Tutorial seven: Publisher Confirms
# terminal tab 1
./gradlew -Pmain=PublisherConfirms run