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.
./mvnw compile
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"
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.
./mvnw exec:java -Dexec.mainClass="ReceiveLogs"
./mvnw exec:java -Dexec.mainClass="EmitLog" -Dexec.args="rabbit1 msg1"
./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."
./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"
In one shell:
./mvnw exec:java -Dexec.mainClass="RPCServer"
In another shell:
./mvnw exec:java -Dexec.mainClass="RPCClient"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。