Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How to configure and use Asynchronous Bus in Liferay 7 plugin ?
Hi guys,
I am converting a liferay 6.2 plugin project to liferay 7 plugin project. In this project we have used Asynchronous Bus , which is configured in messaging-sping.xml . Now in my liferay 7 plugin project, whenever i am trying push Message into MessageBusUtil, it is throwing a NullPointer Exception.
StackTrace:-
java.lang.NullPointerException
at com.liferay.portal.kernel.messaging.BaseAsynchronousDestination.send(BaseDestination.java:173)
at com.liferay.portal.messaging.internal,DefaultMessageBus.sendMessage(DefaultMessageBus.java:232)
at com.liferay.portal.kernel.messaging.MessageBusUtil.sendMessage(MessageBusUtil.java:92)
at DemoLR7.DemoLR7PortletViewController.question(DemoLR7PortletViewController.java:66)
Code:-
Message message=new Message();
message.put("test","Checking Async Message Service");
MessageBusUtil.sendMessage("liferay/asyncbus/destination",message);
messaging-spring.xml:-
(Main Part)
<bean id="liferay.async.bus" class="com.healthplan.pe.events.handlers.AsyncMessageListenerImpl"/>
<bean id="liferay.async.bus.destination" class="com.liferay.portal.kernel.messaging.SerialDestination" >
<property name="name" value="liferay/asyncbus/destination" />
</bean>
<bean id="messagingConfigurator" class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator" >
<property name="messagingListeners">
<map key-type="java.lang.String" value-type="java.util.List">
<entry key="liferay/asyncbus/destination">
<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
<ref bean="liferay.async.bus" />
</list>
</entry>
</map>
</property>
<property name="destinations">
<list>
<ref bean="liferay.async.bus.destination" />
</list>
</property>
</bean>
AsyncMessagingListenerImpl.java code:-
public class AsyncMessagingListenerImpl implements MessageListener{
@Override
public void receive(Message message) throws MessageListenerException{
System.out.println("Received Message::-"+message.getString("test") );
}
}
Web.xml:-
<context-param>
<param-name>portalContextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context/messaging-spring.xml</param-value>
</context-param>
I need your help on this. Any kind of advice,solution,another approach will be a lot of help to me.
I am converting a liferay 6.2 plugin project to liferay 7 plugin project. In this project we have used Asynchronous Bus , which is configured in messaging-sping.xml . Now in my liferay 7 plugin project, whenever i am trying push Message into MessageBusUtil, it is throwing a NullPointer Exception.
StackTrace:-
java.lang.NullPointerException
at com.liferay.portal.kernel.messaging.BaseAsynchronousDestination.send(BaseDestination.java:173)
at com.liferay.portal.messaging.internal,DefaultMessageBus.sendMessage(DefaultMessageBus.java:232)
at com.liferay.portal.kernel.messaging.MessageBusUtil.sendMessage(MessageBusUtil.java:92)
at DemoLR7.DemoLR7PortletViewController.question(DemoLR7PortletViewController.java:66)
Code:-
Message message=new Message();
message.put("test","Checking Async Message Service");
MessageBusUtil.sendMessage("liferay/asyncbus/destination",message);
messaging-spring.xml:-
(Main Part)
<bean id="liferay.async.bus" class="com.healthplan.pe.events.handlers.AsyncMessageListenerImpl"/>
<bean id="liferay.async.bus.destination" class="com.liferay.portal.kernel.messaging.SerialDestination" >
<property name="name" value="liferay/asyncbus/destination" />
</bean>
<bean id="messagingConfigurator" class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator" >
<property name="messagingListeners">
<map key-type="java.lang.String" value-type="java.util.List">
<entry key="liferay/asyncbus/destination">
<list value-type="com.liferay.portal.kernel.messaging.MessageListener">
<ref bean="liferay.async.bus" />
</list>
</entry>
</map>
</property>
<property name="destinations">
<list>
<ref bean="liferay.async.bus.destination" />
</list>
</property>
</bean>
AsyncMessagingListenerImpl.java code:-
public class AsyncMessagingListenerImpl implements MessageListener{
@Override
public void receive(Message message) throws MessageListenerException{
System.out.println("Received Message::-"+message.getString("test") );
}
}
Web.xml:-
<context-param>
<param-name>portalContextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context/messaging-spring.xml</param-value>
</context-param>
I need your help on this. Any kind of advice,solution,another approach will be a lot of help to me.
Manish Kumar Jaiswal, modified 7 Years ago.
Regular Member
Posts: 153
Join Date: 11/25/08
Recent Posts
Hi Pulkit Did you find a solution for this issue , can you please share some code snippet about how to achieve this is Liferay DXP .
Thanks
Manish
Thanks
Manish
Same here i'm creating message bus for Liferay 7.1.2 CE, if anyone can help....?
Thanks in advance
Thanks in advance
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™