Here you can find the Java code examples from RabbitMQ tutorials.
To successfully use the examples you will need a RabbitMQ node running locally.
- Note the source files are symbolic links to the java directory.
- Run pull-source-files.bat to replace symbolic link to the actual source file.
.\pull-source-files.bat
# terminal tab 1
gradle -Pmain=Recv run
# terminal tab 2
gradle -Pmain=Send run
# terminal tab 1
gradle -Pmain=Worker run
gradle -Pmain=Worker run
# terminal tab 2
gradle -Pmain=NewTask run --args "First Message"
gradle -Pmain=NewTask run --args "Second Message"
gradle -Pmain=NewTask run --args "Third Message"
gradle -Pmain=NewTask run --args "Fourth Message"
gradle -Pmain=NewTask run --args "Fifth Message"
# terminal tab 1
gradle -Pmain=ReceiveLogs run
# terminal tab 2
gradle -Pmain=EmitLog run
# terminal tab 1
gradle -Pmain=ReceiveLogsDirect run --args "warning error"
# terminal tab 2
gradle -Pmain=ReceiveLogsDirect run --args "info warning error"
# terminal tab 3
gradle -Pmain=EmitLogDirect run --args "error Run. Run. Or it will explode"
# To receive all the logs:
gradle -Pmain=ReceiveLogsTopic run --args "#"
# To receive all logs from the facility "kern":
gradle -Pmain=ReceiveLogsTopic run --args "kern.*"
# Or if you want to hear only about "critical" logs:
gradle -Pmain=ReceiveLogsTopic run --args "*.critical"
# You can create multiple bindings:
gradle -Pmain=ReceiveLogsTopic run --args "kern.* *.critical"
# And to emit a log with a routing key "kern.critical" type:
gradle -Pmain=EmitLogTopic run --args "kern.critical A critical kernel error"
# Our RPC service is now ready. We can start the server:
gradle -Pmain=RPCServer run
# To request a fibonacci number run the client:
gradle -Pmain=RPCClient run
#
gradle -Pmain=PublisherConfirms run