| 
1 |  | -# Compile the code  | 
 | 1 | +# RabbitMQ Tutorials in Scala  | 
 | 2 | + | 
 | 3 | +This is a minimalistic Scala port of the RabbitMQ tutorials in Java.  | 
 | 4 | +The port is admittedly quite close to Java in terms of code style.  | 
 | 5 | +This is primarily to the fact that RabbitMQ Java client still supports  | 
 | 6 | +JDK 6 and doesn't have a lambda-friendly API.  | 
 | 7 | + | 
 | 8 | + | 
 | 9 | +## Compiling the Code  | 
2 | 10 | 
 
  | 
3 | 11 |  mvn compile  | 
4 | 12 | 
 
  | 
5 |  | -## Hello World  | 
6 | 13 | 
 
  | 
7 |  | -Execute the following command to send a hello world.  | 
 | 14 | +## Running Examples  | 
8 | 15 | 
 
  | 
9 |  | - mvn exec:java -Dexec.mainClass="Send"  | 
 | 16 | +### Hello World  | 
10 | 17 | 
 
  | 
11 |  | -Execute the following command to send a hello world.  | 
 | 18 | +Execute the following command to receive a hello world:  | 
 | 19 | + | 
 | 20 | + mvn exec:java -Dexec.mainClass="Recv"  | 
 | 21 | + | 
 | 22 | +Execute the following in a separate shell to send a hello world:  | 
12 | 23 | 
 
  | 
13 | 24 |  mvn exec:java -Dexec.mainClass="Send"  | 
14 | 25 | 
 
  | 
15 |  | -## Work Queues  | 
 | 26 | +### Work Queues  | 
16 | 27 | 
 
  | 
17 |  | -Send a message which will be finshed immediately  | 
 | 28 | +Send a message which will be finshed immediately:  | 
18 | 29 | 
 
  | 
19 | 30 |  mvn exec:java -Dexec.mainClass="NewTask"  | 
20 | 31 | 
 
  | 
21 |  | -Send a message which need some second to execute each . is one second  | 
 | 32 | +Send a message which need some second to execute each . is one second.  | 
22 | 33 | 
 
  | 
23 | 34 |  mvn exec:java -Dexec.mainClass="NewTask" -Dexec.args="rabbit1 ...."  | 
24 | 35 | 
 
  | 
25 |  | -Open worker. Add more workers to process, message will be handled in round robin way.  | 
 | 36 | +To start a worker (run in a separate shell):  | 
26 | 37 | 
 
  | 
27 | 38 |  mvn exec:java -Dexec.mainClass="Worker"  | 
28 | 39 | 
 
  | 
29 |  | -Kill a worker which is processing message. The message will be still in the queue and will be received by another worker.  | 
 | 40 | +Add more workers to the same queue, message will be distributed in the  | 
 | 41 | +round robin manner.  | 
30 | 42 | 
 
  | 
31 |  | -## Publish and Subscriber  | 
 | 43 | +### Publish and Subscriber  | 
32 | 44 | 
 
  | 
33 | 45 |  mvn exec:java -Dexec.mainClass="EmitLog" -Dexec.args="rabbit1 msg1"  | 
34 | 46 | 
 
  | 
35 | 47 |  mvn exec:java -Dexec.mainClass="ReceiveLogs"  | 
36 | 48 | 
 
  | 
37 |  | -## RPC  | 
 | 49 | +### RPC  | 
38 | 50 | 
 
  | 
39 |  | -Open a shell and execute for the `RPCServer`. `rabbit1` is the host for RabbitMQ, without any execute parameters means to localhost.  | 
 | 51 | +In one shell:  | 
40 | 52 | 
 
  | 
41 | 53 |  mvn exec:java -Dexec.mainClass="RPCServer"  | 
42 | 54 | 
 
  | 
43 |  | - | 
44 |  | -Open another shell and execute for the `RPCClient`.  | 
 | 55 | +In another shell:  | 
45 | 56 | 
 
  | 
46 | 57 |  mvn exec:java -Dexec.mainClass="RPCClient"  | 
0 commit comments