Foros de discusión

Liferay 7 MessageListener osgi module

thumbnail
Anton Gaykevich, modificado hace 6 años.

Liferay 7 MessageListener osgi module

New Member Mensajes: 3 Fecha de incorporación: 20/09/12 Mensajes recientes
<p>Hello. When I worked with the liferay 6.1 I created an application that received the message. Java class:
public class MailMessageBus implements MessageListener
\src\main\webapp\WEB-INF\src\META-INF\messaging-spring.xml:
<beans default-destroy-method="destroy" default-init-method="afterPropertiesSet" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- Root Context: defines shared resources visible to all other web components --> <bean class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator" id="messagingConfigurator"> <property name="messageListeners"><map key-type="java.lang.String" value-type="java.util.List"><entry key="mail-send-message"> <list value-type="com.liferay.portal.kernel.messaging.MessageListener"> <ref bean="messageListener.mail_listener"> </ref></list> </entry></map> </property> <property name="destinations"> <list> <ref bean="destination.mail"> </ref></list> </property> </bean> <!-- Destination class --> <bean class="com.liferay.portal.kernel.messaging.ParallelDestination" id="destination.mail"> <property name="name" value="mail-send-message"> </property></bean> <!-- Listener class --> <bean class="customportlet.AMessageBusListener.MailMessageBus" id="messageListener.mail_listener"> </bean></beans>
\src\main\webapp\WEB-INF\web.xml:
 ... <context-param> <param-name>portalContextConfigLocation</param-name> <param-value>/WEB-INF/src/META-INF/messaging-spring.xml</param-value> </context-param> ... 
How can I do the same for liferay 7 in the OSGi module? OSGi module does not have a web.xml file. Thank you very much!</p>
thumbnail
Liferay Dev, modificado hace 6 años.

RE: Liferay 7 MessageListener osgi module

Junior Member Mensajes: 81 Fecha de incorporación: 17/05/15 Mensajes recientes
Any update on this question?
thumbnail
Harish Kumar, modificado hace 5 años.

RE: Liferay 7 MessageListener osgi module

Expert Mensajes: 483 Fecha de incorporación: 31/07/10 Mensajes recientes

Hi Anton

You can implement Background Task. It makes use of messaging framework behind the scene.

Please follow - https://community.liferay.com/blogs/-/blogs/background-task-a-k-a-the-secret-weapon-behind-the-new-asynchronous-staging

Regards

Harish

thumbnail
Minhchau Dang, modificado hace 5 años.

RE: Liferay 7 MessageListener osgi module

Liferay Master Mensajes: 598 Fecha de incorporación: 22/10/07 Mensajes recientes
Anton Sianko-Haikevich:
How can I do the same for liferay 7 in the OSGi module? OSGi module does not have a web.xml file. Thank you very much!

 

As mentioned in the Message Listeners portion of the developer documentation, there are a few ways you can do it: (a) automatic registration as a Component, (b) registering via MessageBus, and (c) registering directly to a Destination.

DLSyncEventMessageListener from the Liferay Sync service module serves as an example of (a), where you create an OSGi component that has a destination.name property and provides the MessageListener service. As implied from "automatic", Liferay will automatically wire the rest.

Surendra K, modificado hace 5 años.

RE: Liferay 7 MessageListener osgi module

New Member Mensajes: 17 Fecha de incorporación: 10/09/14 Mensajes recientes

Check  the below link .

https://github.com/surendrakp/projects/tree/liferay-7.0/liferay-portal/message-bus-module