List of usage examples for com.liferay.portal.kernel.messaging MessageBusUtil unregisterMessageListener
public static boolean unregisterMessageListener(String destinationName, MessageListener messageListener)
From source file:com.commsen.liferay.multidevice.DeviceRecognitionDestinationEventListener.java
License:Open Source License
@Override public void messageListenerRegistered(String destinationName, MessageListener messageListener) { if (!isProceed(destinationName, messageListener)) { return;//ww w. j a v a 2s . c om } MessageBusUtil.unregisterMessageListener(MultideviceConstants.DESTINATION_DEVICE_RECOGNITION_PROVIDER, deviceRecognitionMessageListener); }
From source file:com.commsen.liferay.multidevice.rules.DeviceRulesDestinationEventListener.java
License:Open Source License
@Override public void messageListenerRegistered(String destinationName, MessageListener messageListener) { if (!isProceed(destinationName, messageListener)) { return;//from w w w .j a v a2 s.co m } MessageBusUtil.unregisterMessageListener(MultideviceConstants.DESTINATION_DEVICE_RULES_PROVIDER, deviceRulesMessageListener); }
From source file:com.liferay.adaptive.media.image.internal.configuration.test.BaseAMImageConfigurationTestCase.java
License:Open Source License
protected List<Message> collectConfigurationMessages(CheckedRunnable runnable) throws Exception { List<Message> messages = new ArrayList<>(); MessageListener messageListener = messages::add; MessageBusUtil.registerMessageListener(AMImageDestinationNames.ADAPTIVE_MEDIA_IMAGE_CONFIGURATION, messageListener);/*from w ww . j a v a2 s. c o m*/ try { runnable.run(); } finally { MessageBusUtil.unregisterMessageListener(AMImageDestinationNames.ADAPTIVE_MEDIA_IMAGE_CONFIGURATION, messageListener); } return messages; }
From source file:com.liferay.adaptive.media.image.internal.test.BaseAdaptiveMediaImageConfigurationTestCase.java
License:Open Source License
protected List<Message> collectConfigurationMessages(CheckedRunnable runnable) throws Exception { String destinationName = AdaptiveMediaImageDestinationNames.ADAPTIVE_MEDIA_IMAGE_CONFIGURATION; try (DestinationReplacer destinationReplacer = new DestinationReplacer(destinationName)) { List<Message> messages = new ArrayList<>(); MessageListener messageListener = messages::add; MessageBusUtil.registerMessageListener(destinationName, messageListener); try {/*ww w . ja va 2s . c o m*/ runnable.run(); } finally { MessageBusUtil.unregisterMessageListener(destinationName, messageListener); } return messages; } }
From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java
License:Open Source License
protected void initMessageListener(String destinationName, MessageListener messageListener, boolean enableScheduler) { MessageBus messageBus = MessageBusUtil.getMessageBus(); Destination destination = messageBus.getDestination(destinationName); if (destination != null) { Set<MessageListener> messageListeners = destination.getMessageListeners(); for (MessageListener curMessageListener : messageListeners) { if (!(curMessageListener instanceof InvokerMessageListener)) { continue; }// www . j a v a 2 s .co m InvokerMessageListener invokerMessageListener = (InvokerMessageListener) curMessageListener; curMessageListener = invokerMessageListener.getMessageListener(); if (messageListener == curMessageListener) { return; } Class<?> messageListenerClass = messageListener.getClass(); String messageListenerClassName = messageListenerClass.getName(); Class<?> curMessageListenerClass = curMessageListener.getClass(); if (!messageListenerClassName.equals(curMessageListenerClass.getName())) { continue; } try { if (enableScheduler) { SchedulerEngineHelperUtil.unschedule(getSchedulerJobName(), getMessageListenerGroupName(), StorageType.MEMORY_CLUSTERED); } MessageBusUtil.unregisterMessageListener(destinationName, curMessageListener); } catch (Exception e) { log.error(e, e); } break; } } else { SerialDestination serialDestination = new SerialDestination(); serialDestination.setName(destinationName); serialDestination.open(); MessageBusUtil.addDestination(serialDestination); } try { MessageBusUtil.registerMessageListener(destinationName, messageListener); if (enableScheduler) { SchedulerEngineHelperUtil.schedule(getSchedulerTrigger(), StorageType.MEMORY_CLUSTERED, null, destinationName, null, 0); } } catch (Exception e) { log.error(e, e); } }
From source file:com.liferay.analytics.internal.osgi.AnalyticsServiceActivator.java
License:Open Source License
@Override public synchronized void stop(BundleContext context) throws Exception { MessageBusUtil.removeDestination(DESTINATION_NAME); MessageBusUtil.unregisterMessageListener(DESTINATION_NAME, this); if (_analyticsEventLocalServiceServiceRegistration != null) { _analyticsEventLocalServiceServiceRegistration.unregister(); _analyticsEventLocalServiceServiceRegistration = null; }/*from w w w. jav a 2s. c o m*/ }
From source file:com.liferay.anonymoususers.internal.osgi.AnonymousUserServiceActivator.java
License:Open Source License
@Override public synchronized void stop(BundleContext context) throws Exception { MessageBusUtil.removeDestination(DESTINATION_NAME); MessageBusUtil.unregisterMessageListener(DESTINATION_NAME, this); if (_anonymousUserLocalServiceServiceRegistration != null) { _anonymousUserLocalServiceServiceRegistration.unregister(); _anonymousUserLocalServiceServiceRegistration = null; }//from w w w . j a va 2 s .com }
From source file:com.liferay.calendar.servlet.CalendarServletContextListener.java
License:Open Source License
@Override protected void doPortalDestroy() throws Exception { MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, _messageListener); }
From source file:com.liferay.contenttargeting.internal.osgi.ContentTargetingActivator.java
License:Open Source License
@Override public synchronized void stop(BundleContext context) throws Exception { MessageBusUtil.removeDestination(DESTINATION_NAME); MessageBusUtil.unregisterMessageListener(DESTINATION_NAME, this); if (_campaignLocalServiceServiceRegistration != null) { _campaignLocalServiceServiceRegistration.unregister(); _campaignLocalServiceServiceRegistration = null; }//from ww w .ja v a 2s .c o m if (_campaignServiceServiceRegistration != null) { _campaignServiceServiceRegistration.unregister(); _campaignServiceServiceRegistration = null; } if (_ruleInstanceLocalServiceServiceRegistration != null) { _ruleInstanceLocalServiceServiceRegistration.unregister(); _ruleInstanceLocalServiceServiceRegistration = null; } if (_ruleInstanceServiceServiceRegistration != null) { _ruleInstanceServiceServiceRegistration.unregister(); _ruleInstanceServiceServiceRegistration = null; } if (_trackingActionInstanceLocalServiceServiceRegistration != null) { _trackingActionInstanceLocalServiceServiceRegistration.unregister(); _trackingActionInstanceLocalServiceServiceRegistration = null; } if (_trackingActionInstanceServiceServiceRegistration != null) { _trackingActionInstanceServiceServiceRegistration.unregister(); _trackingActionInstanceServiceServiceRegistration = null; } if (_userSegmentLocalServiceServiceRegistration != null) { _userSegmentLocalServiceServiceRegistration.unregister(); _userSegmentLocalServiceServiceRegistration = null; } if (_userSegmentServiceServiceRegistration != null) { _userSegmentServiceServiceRegistration.unregister(); _userSegmentServiceServiceRegistration = null; } }
From source file:com.liferay.resourcesimporter.servlet.ResourcesImporterServletContextListener.java
License:Open Source License
protected void doPortalDestroy() throws Exception { MessageBusUtil.unregisterMessageListener(DestinationNames.HOT_DEPLOY, _messageListener); }