| 1 | package omq.ztest.calculator; |
|---|
| 2 | |
|---|
| 3 | import java.util.Properties; |
|---|
| 4 | |
|---|
| 5 | import omq.common.broker.Broker; |
|---|
| 6 | import omq.common.util.ParameterQueue; |
|---|
| 7 | |
|---|
| 8 | public class ServerTest { |
|---|
| 9 | private static CalculatorImpl calc; |
|---|
| 10 | private static CalculatorImpl calc2; |
|---|
| 11 | |
|---|
| 12 | public static void main(String[] args) throws Exception { |
|---|
| 13 | Properties env = new Properties(); |
|---|
| 14 | env.setProperty(ParameterQueue.USER_NAME, "guest"); |
|---|
| 15 | env.setProperty(ParameterQueue.USER_PASS, "guest"); |
|---|
| 16 | |
|---|
| 17 | // Get host info of rabbimq (where it is) |
|---|
| 18 | env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); |
|---|
| 19 | env.setProperty(ParameterQueue.SERVER_PORT, "5672"); |
|---|
| 20 | // env.setProperty(ParameterQueue.SERIALIZERNAME, |
|---|
| 21 | // "omq.common.util.Serializers.KryoImp"); |
|---|
| 22 | env.setProperty(ParameterQueue.SERIALIZERNAME, "omq.common.util.Serializers.GsonImp"); |
|---|
| 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 | } |
|---|