Ignore:
Timestamp:
06/21/13 16:55:58 (11 years ago)
Author:
stoda
Message:

@MultiMethod? implemented and working with @AsyncMethod? annotation.
TODO: @Multi with SyncMethod?(waitNum = x) -> Must return a List<?>
Refactoring in Proxymq if it's necessary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/java/omq/client/proxy/Proxymq.java

    r54 r55  
    4848        private static final long serialVersionUID = 1L;
    4949        private static final Logger logger = Logger.getLogger(Proxymq.class.getName());
     50        private static final String multi = "multi#";
    5051        private static Map<String, Object> proxies = new Hashtable<String, Object>();
    5152
     
    5657        private transient EventDispatcher dispatcher;
    5758        private transient Serializer serializer;
    58         // private transient Channel channel;
    5959        private transient Properties env;
    6060        private transient Map<String, byte[]> results;
     
    111111        @Override
    112112        public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable {
    113                 // long timeStart = (new Date()).getTime();
    114 
    115113                // Local methods only
    116114                String methodName = method.getName();
     
    151149
    152150                // Get the environment properties
    153                 String exchange = env.getProperty(ParameterQueue.RPC_EXCHANGE);
    154                 String routingkey = this.uid;
     151                String exchange;
     152                String routingkey;
     153
     154                if (request.isMulti()) {
     155                        exchange = multi + env.getProperty(ParameterQueue.RPC_EXCHANGE);
     156                        routingkey = "";
     157                } else {
     158                        exchange = env.getProperty(ParameterQueue.RPC_EXCHANGE);
     159                        routingkey = uid;
     160                }
    155161
    156162                // Add the correlation ID and create a replyTo property
     
    159165                // Publish the message
    160166                byte[] bytesRequest = serializer.serialize(serializerType, request);
    161                 // TODO See this
    162                 // channel.basicPublish(exchange, routingkey, props, bytesRequest);
    163167                broker.getChannel().basicPublish(exchange, routingkey, props, bytesRequest);
    164168        }
     
    213217                                timeout = sync.timeout();
    214218                        }
    215                         return Request.newSyncRequest(corrId, methodName, arguments, retries, timeout);
     219                        return Request.newSyncRequest(corrId, methodName, arguments, retries, timeout, multi);
    216220                } else {
    217221                        return Request.newAsyncRequest(corrId, methodName, arguments, multi);
Note: See TracChangeset for help on using the changeset viewer.