source: trunk/objectmq/test/stopBroker/ClientTest.java @ 37

Last change on this file since 37 was 37, checked in by stoda, 11 years ago

Stop broker working and unbind too.

File size: 1.4 KB
Line 
1package stopBroker;
2
3import java.util.Properties;
4
5import omq.common.broker.Broker;
6import omq.common.util.ParameterQueue;
7import omq.common.util.Serializer;
8
9public class ClientTest {
10
11        /**
12         * @param args
13         * @throws Exception
14         */
15        public static void main(String[] args) throws Exception {
16                Properties env = new Properties();
17                env.setProperty(ParameterQueue.USER_NAME, "guest");
18                env.setProperty(ParameterQueue.USER_PASS, "guest");
19
20                // Set host info of rabbimq (where it is)
21                env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1");
22                env.setProperty(ParameterQueue.SERVER_PORT, "5672");
23                env.setProperty(ParameterQueue.DURABLE_QUEUES, "false");
24                env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);
25                env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false");
26
27                // Set info about where the message will be sent
28                env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange");
29                // env.setProperty(ParameterQueue.DEBUGFILE, "c:\\middlewareDebug");
30
31                // Set info about the queue & the exchange where the ResponseListener
32                // will listen to.
33                env.setProperty(ParameterQueue.RPC_REPLY_QUEUE, "reply_queue");
34                env.setProperty(ParameterQueue.EVENT_REPLY_QUEUE, "event_queue");
35                env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "5000");
36
37                Broker.initBroker(env);
38                BrokerKiller bk = (BrokerKiller) Broker.lookup("bk", BrokerKiller.class);
39
40                bk.killServerBroker();
41                Broker.stopBroker();
42        }
43
44}
Note: See TracBrowser for help on using the repository browser.