[46] | 1 | package omq.test.stopBroker; |
---|
[44] | 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; |
---|
[46] | 8 | import omq.test.calculator.CalculatorImpl; |
---|
[44] | 9 | |
---|
| 10 | public class UnbindTest { |
---|
| 11 | private static CalculatorImpl calc; |
---|
| 12 | |
---|
| 13 | /** |
---|
| 14 | * @param args |
---|
| 15 | */ |
---|
| 16 | public static void main(String[] args) throws Exception { |
---|
| 17 | Properties env = new Properties(); |
---|
| 18 | env.setProperty(ParameterQueue.USER_NAME, "guest"); |
---|
| 19 | env.setProperty(ParameterQueue.USER_PASS, "guest"); |
---|
| 20 | |
---|
| 21 | // Get host info of rabbimq (where it is) |
---|
| 22 | env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); |
---|
| 23 | env.setProperty(ParameterQueue.SERVER_PORT, "5672"); |
---|
| 24 | env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); |
---|
| 25 | env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java); |
---|
| 26 | env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); |
---|
| 27 | |
---|
| 28 | // Set info about where the message will be sent |
---|
| 29 | env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); |
---|
| 30 | env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); |
---|
| 31 | |
---|
| 32 | String reference = "calculator1"; |
---|
| 33 | calc = new CalculatorImpl(); |
---|
| 34 | |
---|
| 35 | Broker.initBroker(env); |
---|
| 36 | Broker.bind(reference, calc); |
---|
| 37 | |
---|
| 38 | Broker.unbind(reference); |
---|
| 39 | |
---|
| 40 | Broker.closeConnection(); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | } |
---|