Example usage for com.liferay.portal.kernel.messaging MessageBus registerMessageListener

List of usage examples for com.liferay.portal.kernel.messaging MessageBus registerMessageListener

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.messaging MessageBus registerMessageListener.

Prototype

public boolean registerMessageListener(String destinationName, MessageListener messageListener);

Source Link

Usage

From source file:com.liferay.analytics.internal.osgi.AnalyticsServiceActivator.java

License:Open Source License

@Override
public synchronized void start(BundleContext bundleContext) throws Exception {

    _bundleContext = bundleContext;//from ww w  .ja v a2 s  .c o m

    SerialDestination destination = new SerialDestination(DESTINATION_NAME);

    MessageBus messageBus = ServiceTrackerUtil.getService(MessageBus.class, bundleContext);

    messageBus.addDestination(destination);

    messageBus.registerMessageListener(DESTINATION_NAME, this);
}

From source file:com.liferay.analytics.messaging.AnalyticsHotDeployMessageListener.java

License:Open Source License

@Override
protected void onDeploy(Message message) throws Exception {
    MessageBus messageBus = MessageBusUtil.getMessageBus();

    try {//w w w  .  j a  v  a  2 s.  c o m
        messageBus.registerMessageListener(_analyticsMessageDestination, _analyticsMessageListener);

        if (_log.isInfoEnabled()) {
            _log.info("Registering message listener for " + _analyticsMessageDestination);
        }
    } catch (Exception e) {
        _log.error("Cannot register message listener for" + _analyticsMessageDestination);
    }
}

From source file:com.liferay.content.targeting.analytics.messaging.AnalyticsHotDeployMessageListener.java

License:Open Source License

@Override
protected void onDeploy(Message message) throws Exception {
    MessageBus messageBus = MessageBusUtil.getMessageBus();

    try {/*from w ww  .  j ava  2s .  c  om*/
        messageBus.registerMessageListener(_analyticsMessageDestination, _analyticsMessageListener);

        if (_log.isInfoEnabled()) {
            _log.info("Registering message listener for " + _analyticsMessageDestination);
        }
    } catch (Exception e) {
        _log.error("Cannot register message listener for" + _analyticsMessageDestination, e);
    }
}

From source file:com.liferay.mobile.camel.LiferayConsumer.java

License:Open Source License

@Override
protected void doStart() throws Exception {
    super.doStart();

    LiferayEndpoint endpoint = getEndpoint();
    MessageBus messageBus = endpoint.getMessageBus();
    String destinationName = endpoint.getDestinationName();

    messageBus.registerMessageListener(destinationName, this);
}

From source file:se.vgregion.messagebus.MessageBusConsumer.java

License:Open Source License

protected void doStart() throws Exception {
    MessageBusEndpoint endpoint = (MessageBusEndpoint) getEndpoint();
    MessageBus messageBus = endpoint.getMessageBus();

    String destination = endpoint.getDestination();

    messageBus.addDestination(new ParallelDestination(destination));

    messageBus.registerMessageListener(destination, new EndpointMessageListener(endpoint, getProcessor()));
}