Package com.hazelcast.core

Examples of com.hazelcast.core.MessageListener


    protected TopicMBean(ITopic managedObject, ManagementService service) {
        super(managedObject, service);
        objectName = service.createObjectName("ITopic", managedObject.getName());

        //can't we rely on the statics functionality of the topic instead of relying on the event system?
        MessageListener messageListener = new MessageListener() {
            public void onMessage(Message message) {
                totalMessageCount.incrementAndGet();
            }
        };
        registrationId = managedObject.addMessageListener(messageListener);
View Full Code Here


        }
    }

    private List<Runnable> loadTopicOperations() {
        ITopic topic = hazelcast.getTopic("myTopic");
        topic.addMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                messagesReceived.incrementAndGet();
            }
        });
        List<Runnable> operations = new ArrayList<Runnable>();
View Full Code Here

    }

    private void initialize(ListenerConfig listenerConfig) {
        NodeEngine nodeEngine = getNodeEngine();

        MessageListener listener;
        try {
            listener = (MessageListener) listenerConfig.getImplementation();
            if (listener == null && listenerConfig.getClassName() != null) {
                listener = ClassLoaderUtil.newInstance(configClassLoader, listenerConfig.getClassName());
            }
View Full Code Here

    public void dispatchEvent(Object event, Object listener) {
        TopicEvent topicEvent = (TopicEvent) event;
        Object msgObject = nodeEngine.toObject(topicEvent.data);
        Message message = new Message(topicEvent.name, msgObject, topicEvent.publishTime, topicEvent.publishingMember);
        incrementReceivedMessages(topicEvent.name);
        MessageListener messageListener = (MessageListener) listener;
        messageListener.onMessage(message);
    }
View Full Code Here

    @Override
    public String call() throws Exception {
        TopicService service = getService();
        ClientEngine clientEngine = getClientEngine();
        ClientEndpoint endpoint = getEndpoint();
        MessageListener listener = new MessageListenerImpl(endpoint, clientEngine, getCallId());
        String registrationId = service.addMessageListener(name, listener);
        endpoint.setListenerRegistration(TopicService.SERVICE_NAME, name, registrationId);
        return registrationId;
    }
View Full Code Here

    }

    private void initialize(ListenerConfig listenerConfig) {
        NodeEngine nodeEngine = getNodeEngine();

        MessageListener listener = loadListener(listenerConfig);

        if (listener == null) {
            return;
        }
View Full Code Here

        addMessageListenerInternal(listener);
    }

    private MessageListener loadListener(ListenerConfig listenerConfig) {
        try {
            MessageListener listener = (MessageListener) listenerConfig.getImplementation();
            if (listener == null && listenerConfig.getClassName() != null) {
                listener = ClassLoaderUtil.newInstance(configClassLoader, listenerConfig.getClassName());
            }
            return listener;
        } catch (Exception e) {
View Full Code Here

            }
            return;
        }
        Message message = new Message(topicEvent.name, msgObject, topicEvent.publishTime, member);
        incrementReceivedMessages(topicEvent.name);
        MessageListener messageListener = (MessageListener) listener;
        messageListener.onMessage(message);
    }
View Full Code Here

    @Override
    public String call() throws Exception {
        TopicService service = getService();
        ClientEndpoint endpoint = getEndpoint();
        MessageListener listener = new MessageListenerImpl(endpoint, serializationService, getCallId());
        String registrationId = service.addMessageListener(name, listener);
        endpoint.setListenerRegistration(TopicService.SERVICE_NAME, name, registrationId);
        return registrationId;
    }
View Full Code Here

        }
        return null;
    }

    private MessageListener createMessageListener(final CountDownLatch latch) {
        return new MessageListener() {
            @Override
            public void onMessage(Message message) {
                latch.countDown();
            }
        };
View Full Code Here

TOP

Related Classes of com.hazelcast.core.MessageListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.