Ignore:
Timestamp:
06/20/13 16:57:39 (11 years ago)
Author:
stoda
Message:

Non static broker
TODO: change all test to see whether the new broker configuration works

File:
1 edited

Legend:

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

    r49 r53  
    5151        private String uid;
    5252        private transient String serializerType;
     53        private transient Broker broker;
    5354        private transient ResponseListener rListener;
    5455        private transient EventDispatcher dispatcher;
     56        private transient Serializer serializer;
    5557        // private transient Channel channel;
    5658        private transient Properties env;
     
    8587         * @throws Exception
    8688         */
    87         public Proxymq(String uid, Class<?> clazz, Properties env) throws Exception {
     89        public Proxymq(String uid, Class<?> clazz, Broker broker) throws Exception {
    8890                this.uid = uid;
    89                 this.rListener = ResponseListener.getRequestListener();
    90                 this.dispatcher = EventDispatcher.getDispatcher();
     91                this.broker = broker;
     92                rListener = broker.getResponseListener();
     93                dispatcher = broker.getEventDispatcher();
     94                serializer = broker.getSerializer();
    9195
    9296                // TODO what is better to use a new channel or to use the same?
    9397                // this.channel = Broker.getChannel();
    94                 this.env = env;
     98                env = broker.getEnvironment();
    9599
    96100                // set the serializer type
     
    160164
    161165                // Publish the message
    162                 byte[] bytesRequest = Serializer.serialize(serializerType, request);
     166                byte[] bytesRequest = serializer.serialize(serializerType, request);
    163167                // TODO See this
    164168                // channel.basicPublish(exchange, routingkey, props, bytesRequest);
    165                 Broker.getChannel().basicPublish(exchange, routingkey, props, bytesRequest);
     169                broker.getChannel().basicPublish(exchange, routingkey, props, bytesRequest);
    166170                // Log.saveLog("Client-Serialize", bytesRequest);
    167171        }
     
    232236                                throw new TimeoutException("Timeout exception time: " + timeout);
    233237                        }
    234                         resp = Serializer.deserializeResponse(results.get(corrId), type);
     238                        resp = serializer.deserializeResponse(results.get(corrId), type);
    235239                        // Log.saveLog("Client-Deserialize", results.get(corrId));
    236240
Note: See TracChangeset for help on using the changeset viewer.