@Override
        public void register(final Subscriber subscriber) {
            if (subscriber == null) {
                throw new NullPointerException("Subscriber cannot be null.");
            }
            synchronized (mutex) {
                if (topicSubscribers.containsKey(subscriber.getTopic())) {
                    if (!topicSubscribers.get(subscriber.getTopic()).contains(subscriber)) {
                        List<Subscriber> list = new ArrayList<>(topicSubscribers.get(subscriber.getTopic()));
                        list.add(subscriber);
                        topicSubscribers.put(subscriber.getTopic(), list);
                    }
                } else {
                    topicSubscribers.put(subscriber.getTopic(), new ArrayList<Subscriber>() {
                        {
                            add(subscriber);
                        }
                    });
                }
            }
        }
Subscriber interface to be implemented to subscribe to in-memory broker.
modules/siddhi-core/src/main/java/io/siddhi/core/util/transport/InMemoryBroker.java