Ignore:
Timestamp:
06/29/13 20:44:27 (11 years ago)
Author:
stoda
Message:

Events deleted instead of them there's a new example of how to use the observer pattern

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main/java/omq/common/broker/Broker.java

    r70 r72  
    1313import omq.client.proxy.MultiProxymq;
    1414import omq.client.proxy.Proxymq;
    15 import omq.common.event.Event;
    16 import omq.common.event.EventDispatcher;
    17 import omq.common.event.EventWrapper;
    1815import omq.common.util.OmqConnectionFactory;
    1916import omq.common.util.ParameterQueue;
     
    2118import omq.exception.InitBrokerException;
    2219import omq.exception.RemoteException;
    23 import omq.exception.SerializerException;
    2420import omq.server.RemoteObject;
    2521
     
    4137        private Channel channel;
    4238        private ResponseListener responseListener;
    43         private EventDispatcher eventDispatcher;
    4439        private Serializer serializer;
    4540        private boolean clientStarted = false;
     
    7570                if (clientStarted) {
    7671                        responseListener.kill();
    77                         eventDispatcher.kill();
    7872                        // TODO proxies = null; ??
    7973                }
     
    211205                        responseListener.start();
    212206                }
    213                 if (eventDispatcher == null) {
    214                         eventDispatcher = new EventDispatcher(this);
    215                         eventDispatcher.start();
    216                 }
    217         }
    218 
    219         /**
    220          * This method sends an event with its information
    221          *
    222          * @param event
    223          * @throws IOException
    224          * @throws SerializerException
    225          */
    226         public void trigger(Event event) throws IOException, SerializerException {
    227                 String UID = event.getTopic();
    228                 EventWrapper wrapper = new EventWrapper(event);
    229                 logger.debug("EventTrigger fanout exchange: " + UID + " Event topic: " + UID + " Event corrID: " + event.getCorrId());
    230                 channel.exchangeDeclare(UID, "fanout");
    231 
    232                 byte[] bytesResponse = serializer.serialize(wrapper);
    233                 channel.basicPublish(UID, "", null, bytesResponse);
    234207        }
    235208
     
    318291        }
    319292
    320         public EventDispatcher getEventDispatcher() {
    321                 return eventDispatcher;
    322         }
    323 
    324293        public Serializer getSerializer() {
    325294                return serializer;
Note: See TracChangeset for help on using the changeset viewer.