[33] | 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 ServerTest { |
---|
| 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 | // Get 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 | env.setProperty(ParameterQueue.NUM_THREADS, "4"); |
---|
| 22 | |
---|
| 23 | // Set info about where the message will be sent |
---|
| 24 | env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); |
---|
| 25 | env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); |
---|
| 26 | |
---|
| 27 | String car = "audi"; |
---|
| 28 | String tfn = "aifon"; |
---|
| 29 | |
---|
| 30 | Broker.initBroker(env); |
---|
| 31 | Broker.bind(car, new CarImpl()); |
---|
| 32 | Broker.bind(tfn, new MobileImpl()); |
---|
| 33 | |
---|
| 34 | System.out.println("Server started"); |
---|
| 35 | } |
---|
| 36 | } |
---|