source: branches/objectmq_old/test/calculatorTest/ServerTest.java

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

Remote exception added
todo: change throws Exception to Throwable since it seems that NoSuchMethodException? does not inherit from Exception...

File size: 1.2 KB
Line 
1package calculatorTest;
2
3import java.util.Properties;
4
5import omq.common.broker.Broker;
6import omq.common.util.ParameterQueue;
7import omq.common.util.Serializer;
8
9public 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}
Note: See TracBrowser for help on using the repository browser.