1 | package calculatorTest; |
---|
2 | |
---|
3 | import java.util.Properties; |
---|
4 | |
---|
5 | import omq.common.broker.Broker; |
---|
6 | import omq.common.util.ParameterQueue; |
---|
7 | import omq.common.util.Serializer; |
---|
8 | |
---|
9 | public class ServerTest { |
---|
10 | private static CalculatorImpl calc; |
---|
11 | private static CalculatorImpl calc2; |
---|
12 | |
---|
13 | public static void main(String[] args) throws Exception { |
---|
14 | Properties env = new Properties(); |
---|
15 | env.setProperty(ParameterQueue.USER_NAME, "guest"); |
---|
16 | env.setProperty(ParameterQueue.USER_PASS, "guest"); |
---|
17 | |
---|
18 | // Get host info of rabbimq (where it is) |
---|
19 | env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); |
---|
20 | env.setProperty(ParameterQueue.SERVER_PORT, "5672"); |
---|
21 | env.setProperty(ParameterQueue.DURABLE_QUEUES, "true"); |
---|
22 | env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java); |
---|
23 | env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); |
---|
24 | |
---|
25 | // Set info about where the message will be sent |
---|
26 | env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); |
---|
27 | env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); |
---|
28 | |
---|
29 | calc = new CalculatorImpl(); |
---|
30 | calc2 = new CalculatorImpl(); |
---|
31 | |
---|
32 | Broker.initBroker(env); |
---|
33 | Broker.bind("calculator1", calc); |
---|
34 | Broker.bind("calculator2", calc2); |
---|
35 | |
---|
36 | System.out.println("Server started"); |
---|
37 | } |
---|
38 | } |
---|