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/server/RemoteObject.java

    r67 r72  
    44import java.lang.reflect.Method;
    55import java.util.ArrayList;
    6 import java.util.Collection;
    76import java.util.HashMap;
    87import java.util.List;
     
    109import java.util.Properties;
    1110
    12 import org.apache.log4j.Logger;
    13 
    1411import omq.Remote;
    1512import omq.common.broker.Broker;
    16 import omq.common.event.Event;
    17 import omq.common.event.EventListener;
    18 import omq.common.event.EventWrapper;
    1913import omq.common.util.ParameterQueue;
    20 import omq.common.util.Serializer;
    2114import omq.exception.SerializerException;
     15
     16import org.apache.log4j.Logger;
    2217
    2318import com.rabbitmq.client.Channel;
     
    4237        private Properties env;
    4338        private transient Broker broker;
    44         private transient Serializer serializer;
    4539        private transient RemoteWrapper remoteWrapper;
    4640        private transient Map<String, List<Class<?>>> params;
     
    6963                multiQueue = UID + System.currentTimeMillis();
    7064                env = broker.getEnvironment();
    71                 serializer = broker.getSerializer();
    7265
    7366                params = new HashMap<String, List<Class<?>>>();
     
    9386                this.broker = broker;
    9487                UID = reference;
    95                 serializer = broker.getSerializer();
    9688                if (channel == null || !channel.isOpen()) {
    9789                        channel = broker.getChannel();
     
    141133        }
    142134
    143         @Override
    144         public void notifyEvent(Event event) throws IOException, SerializerException {
    145                 String corrID = java.util.UUID.randomUUID().toString();
    146                 event.setTopic(UID);
    147                 event.setCorrId(corrID);
    148                 EventWrapper wrapper = new EventWrapper(event);
    149                 channel.exchangeDeclare(UID, "fanout");
    150                 channel.basicPublish(UID, "", null, serializer.serialize(wrapper));
    151                 logger.debug("Sending event-> topic: " + UID + ", corrID: " + corrID);
    152         }
    153 
    154135        public void kill() throws IOException {
    155136                logger.warn("Killing objectmq: " + this.getRef());
     
    265246        }
    266247
    267         @Override
    268         public void addListener(EventListener<?> eventListener) throws Exception {
    269         }
    270 
    271         @Override
    272         public void removeListener(EventListener<?> eventListener) throws Exception {
    273         }
    274 
    275         @Override
    276         public Collection<EventListener<?>> getListeners() throws Exception {
    277                 return null;
    278         }
    279 
    280248}
Note: See TracChangeset for help on using the changeset viewer.