1 | package test2; |
---|
2 | |
---|
3 | import java.util.Properties; |
---|
4 | |
---|
5 | import omq.common.broker.Broker; |
---|
6 | import omq.common.util.ParameterQueue; |
---|
7 | |
---|
8 | public class ClientTest { |
---|
9 | |
---|
10 | public static void main(String[] args) throws Exception { |
---|
11 | Properties env = new Properties(); |
---|
12 | env.setProperty(ParameterQueue.USER_NAME, "guest"); |
---|
13 | env.setProperty(ParameterQueue.USER_PASS, "guest"); |
---|
14 | |
---|
15 | // Set host info of rabbimq (where it is) |
---|
16 | env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); |
---|
17 | env.setProperty(ParameterQueue.SERVER_PORT, "5672"); |
---|
18 | // env.setProperty(ParameterQueue.SERIALIZERNAME, |
---|
19 | // "omq.common.util.Serializers.GsonImp"); |
---|
20 | env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); |
---|
21 | |
---|
22 | // Set info about where the message will be sent |
---|
23 | env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); |
---|
24 | // Set info about the queue & the exchange where the ResponseListener |
---|
25 | // will listen to. |
---|
26 | env.setProperty(ParameterQueue.RPC_REPLY_QUEUE, "reply_queue"); |
---|
27 | env.setProperty(ParameterQueue.EVENT_REPLY_QUEUE, "event_queue"); |
---|
28 | |
---|
29 | Broker.initBroker(env); |
---|
30 | |
---|
31 | String car = "audi"; |
---|
32 | String tfn = "aifon"; |
---|
33 | Object lock = new Object(); |
---|
34 | CarThread t1 = new CarThread(car, tfn, lock); |
---|
35 | MobileThread t2 = new MobileThread(tfn, lock); |
---|
36 | |
---|
37 | t1.start(); |
---|
38 | t2.start(); |
---|
39 | |
---|
40 | } |
---|
41 | } |
---|