Changeset 75


Ignore:
Timestamp:
07/02/13 11:50:11 (11 years ago)
Author:
stoda
Message:

Multi problem solved

Location:
trunk
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/pom.xml

    r64 r75  
    4949                        <groupId>com.esotericsoftware.kryo</groupId>
    5050                        <artifactId>kryo</artifactId>
    51                         <version>2.21</version>
     51                        <version>2.20</version>
    5252                </dependency>
    5353                <dependency>
  • trunk/src/main/java/omq/client/proxy/MultiProxymq.java

    r70 r75  
    44import java.lang.reflect.Method;
    55import java.util.Properties;
     6
     7import org.apache.log4j.Logger;
    68
    79import com.rabbitmq.client.AMQP.BasicProperties;
     
    2022 */
    2123public class MultiProxymq implements InvocationHandler {
     24        private static final Logger logger = Logger.getLogger(MultiProxymq.class.getName());
    2225        private static final String multi = "multi#";
    2326
     
    3740                Properties env = broker.getEnvironment();
    3841                replyQueueName = env.getProperty(ParameterQueue.RPC_REPLY_QUEUE);
    39                 exchange = multi + env.getProperty(ParameterQueue.RPC_EXCHANGE);
     42                exchange = multi + uid;
    4043                serializerType = env.getProperty(ParameterQueue.SERIALIZER_NAME, Serializer.JAVA);
    4144        }
     
    5558                broker.getChannel().basicPublish(exchange, routingkey, props, bytesRequest);
    5659
     60                logger.debug("Proxymq: " + uid + " invokes " + methodName + ", corrID" + corrId + ", exchange: " + exchange + ", replyQueue: " + replyQueueName
     61                                + ", serializerType: " + serializerType + ", multi call: " + request.isMulti() + ", async call: " + request.isAsync());
     62
    5763                return null;
    5864        }
  • trunk/src/main/java/omq/client/proxy/Proxymq.java

    r72 r75  
    9090                env = broker.getEnvironment();
    9191                exchange = env.getProperty(ParameterQueue.RPC_EXCHANGE);
    92                 multiExchange = multi + exchange;
     92                multiExchange = multi + uid;
    9393                replyQueueName = env.getProperty(ParameterQueue.RPC_REPLY_QUEUE);
    9494
  • trunk/src/main/java/omq/common/message/Request.java

    r58 r75  
    2323        }
    2424
    25         public Request(String id, String method, Object[] params) {
    26                 this.id = id;
    27                 this.method = method;
    28                 this.params = params;
    29         }
    30 
    31         private Request(String id, String method, boolean async, Object[] params) {
     25        public Request(String id, String method, boolean async, Object[] params) {
    3226                this.id = id;
    3327                this.method = method;
     
    3630        }
    3731
    38         private Request(String id, String method, boolean async, Object[] params, boolean multi) {
     32        public Request(String id, String method, boolean async, Object[] params, boolean multi) {
    3933                this.id = id;
    4034                this.method = method;
  • trunk/src/main/java/omq/common/util/Serializers/GsonImp.java

    r72 r75  
    3333                String id = jsonObj.get("id").getAsString();
    3434                String method = jsonObj.get("method").getAsString();
     35                boolean async = jsonObj.get("async").getAsBoolean();
    3536
    3637                List<Class<?>> types = obj.getParams(method);
     
    4849                                i++;
    4950                        }
    50 
    51                         return new Request(id, method, arguments);
     51                        return new Request(id, method, async, arguments);
    5252                } catch (NullPointerException e) {
    53                         return new Request(id, method, null);
     53                        return new Request(id, method, async, null);
    5454                }
    5555        }
  • trunk/src/main/java/omq/server/RemoteObject.java

    r74 r75  
    9797                                Delivery delivery = consumer.nextDelivery();
    9898
    99                                 logger.debug(UID + " has received a message");
     99                                logger.debug(UID + " has received a message, serializer: " + delivery.getProperties().getType());
    100100
    101101                                remoteWrapper.notifyDelivery(delivery);
     
    219219                String routingKey = UID;
    220220                // Multi info
    221                 String multiExchange = multi + exchange;
     221                String multiExchange = multi + UID;
    222222
    223223                boolean durable = Boolean.parseBoolean(env.getProperty(ParameterQueue.DURABLE_QUEUES, "false"));
  • trunk/src/main/resources/log4j.xml

    r64 r75  
    44<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    55    <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
    6         <param name="Threshold" value="INFO" />
     6        <param name="Threshold" value="DEBUG" />
    77        <layout class="org.apache.log4j.PatternLayout">
    88            <param name="ConversionPattern" value="%d{[yyyy-MM-dd HH:mm:ss]} %-5p %c:%L - %m%n" />
     
    3030
    3131  <root>
    32     <priority value ="info" />
     32    <priority value ="DEBUG" />
    3333    <appender-ref ref="consoleAppender" />
    3434    <appender-ref ref="A2" /> 
  • trunk/src/test/java/omq/test/workspace/WorkspaceTest.java

    r74 r75  
    2020@RunWith(value = Parameterized.class)
    2121public class WorkspaceTest {
     22        private String type;
    2223        private static Broker serverBroker;
    2324        private static Broker clientBroker1;
    2425        private static Broker clientBroker2;
     26        private static RemoteWorkspaceImpl w1C1;
     27        private static RemoteWorkspaceImpl w3C1;
     28        private static RemoteWorkspaceImpl w1C2;
     29        private static RemoteWorkspaceImpl w2C2;
    2530        private static String[] workspaces = { "w1", "w2", "w3" };
    2631        private static RemoteWorkspace[] remoteWorks = new RemoteWorkspace[3];
     
    2833        // In this case the Constructor acts as a server
    2934        public WorkspaceTest(String type) throws Exception {
     35                this.type = type;
    3036                Properties env = new Properties();
    3137                env.setProperty(ParameterQueue.USER_NAME, "guest");
     
    7581                clientBroker2 = new Broker(env);
    7682
     83                // Client 1 will subscribe to changes in the workspaces w1 and w3
     84                w1C1 = new RemoteWorkspaceImpl();
     85                w3C1 = new RemoteWorkspaceImpl();
     86
     87                clientBroker1.bind(workspaces[0], w1C1);
     88                clientBroker1.bind(workspaces[2], w3C1);
     89
     90                // Client 2 will subscribe to changes in the workspaces w1 and w2
     91                w1C2 = new RemoteWorkspaceImpl();
     92                w2C2 = new RemoteWorkspaceImpl();
     93
     94                clientBroker2.bind(workspaces[0], w1C2);
     95                clientBroker2.bind(workspaces[1], w2C2);
     96
    7797                System.out.println("Client 1 & client2 started");
    7898        }
     
    85105        @Test
    86106        public void test() throws Exception {
     107                System.out.println("Starting test: " + type);
    87108                String expected = null;
    88109                String actual = null;
    89 
    90                 // Client 1 will subscribe to changes in the workspaces w1 and w3
    91                 RemoteWorkspaceImpl w1C1 = new RemoteWorkspaceImpl();
    92                 RemoteWorkspaceImpl w3C1 = new RemoteWorkspaceImpl();
    93 
    94                 clientBroker1.bind(workspaces[0], w1C1);
    95                 clientBroker1.bind(workspaces[2], w3C1);
    96 
    97                 // Client 2 will subscribe to changes in the workspaces w1 and w2
    98                 RemoteWorkspaceImpl w1C2 = new RemoteWorkspaceImpl();
    99                 RemoteWorkspaceImpl w2C2 = new RemoteWorkspaceImpl();
    100 
    101                 clientBroker2.bind(workspaces[0], w1C2);
    102                 clientBroker2.bind(workspaces[2], w2C2);
    103110
    104111                // The server will notify a change in the w2
Note: See TracChangeset for help on using the changeset viewer.