rabbitmq-tutorials/scala
Spring Operator 264e8d6d1a URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://smartbearsoftware.com/repository/maven2 (301) could not be migrated:
   ([https](https://smartbearsoftware.com/repository/maven2) result SSLHandshakeException).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://www.apache.org/licenses/LICENSE-2.0 migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0
* http://maven.apache.org/maven-v4_0_0.xsd
* http://maven.apache.org/xsd/maven-4.0.0.xsd
* http://www.w3.org/2001/XMLSchema-instance
2019-03-11 21:56:13 -05:00
..
.mvn/wrapper Upgrade Scala tutorials 2018-12-04 16:31:20 +01:00
src/main/scala Upgrade Scala tutorials 2018-12-04 16:31:20 +01:00
mvnw URL Cleanup 2019-03-11 21:56:13 -05:00
mvnw.cmd URL Cleanup 2019-03-11 21:56:13 -05:00
pom.xml Upgrade Scala tutorials 2018-12-04 16:31:20 +01:00
README.md Upgrade Scala tutorials 2018-12-04 16:31:20 +01:00

RabbitMQ Tutorials in Scala

This is a minimalistic Scala port of the RabbitMQ tutorials in Java. The port is admittedly quite close to Java in terms of code style. This is primarily to the fact that RabbitMQ Java client still supports JDK 6 and doesn't have a lambda-friendly API.

Compiling the Code

./mvnw compile

Running Examples

Hello World

Execute the following command to receive a hello world:

./mvnw exec:java -Dexec.mainClass="Recv"

Execute the following in a separate shell to send a hello world:

./mvnw exec:java -Dexec.mainClass="Send"

Work Queues

Send a message which will be finished immediately:

./mvnw exec:java -Dexec.mainClass="NewTask"

Send a message which need some second to execute each . is one second.

./mvnw exec:java -Dexec.mainClass="NewTask" -Dexec.args="rabbit1 ...."

To start a worker (run in a separate shell):

./mvnw exec:java -Dexec.mainClass="Worker"

Add more workers to the same queue, message will be distributed in the round robin manner.

Publish and Subscriber

./mvnw exec:java -Dexec.mainClass="ReceiveLogs"

./mvnw exec:java -Dexec.mainClass="EmitLog" -Dexec.args="rabbit1 msg1"

Routing

./mvnw exec:java -Dexec.mainClass="ReceiveLogsDirect" -Dexec.args="info warning error"

./mvnw exec:java -Dexec.mainClass="EmitLogDirect" -Dexec.args="error Run. Run. Or it will explode."

Topics

./mvnw exec:java -Dexec.mainClass="ReceiveLogsTopic" -Dexec.args="#"

./mvnw exec:java -Dexec.mainClass="ReceiveLogsTopic" -Dexec.args="kern.*"

./mvnw exec:java -Dexec.mainClass="ReceiveLogsTopic" -Dexec.args="*.critical"

./mvnw exec:java -Dexec.mainClass="ReceiveLogsTopic" -Dexec.args="kern.* *.critical"

./mvnw exec:java -Dexec.mainClass="EmitLogTopic" -Dexec.args="kern.critical A critical kernel error"

RPC

In one shell:

./mvnw exec:java -Dexec.mainClass="RPCServer"

In another shell:

./mvnw exec:java -Dexec.mainClass="RPCClient"