Follow below Article to understand more about Message Bus in Liferay.
http://www.liferaysavvy.com/2021/07/working-with-liferay-message-bus.html
Implementation Steps
- Create Destination Configuration
- Create Destination
- Register Destination as OSGi Service
- Manage the Destination Object
- Register Listener
- Send Message to Destination
GitHub Project
https://github.com/LiferaySavvy/liferay-messagebus-example
Module Implementation
Module demonstrates to create different types of
message bus destinations and different ways to register listeners with message
bus.
Module have simple UI screens to send messages on
Message Bus and view the statistics of each message bus destination.
Software Stack
Liferay-ce-portal-7.4.1-ga2 Liferay
Developer Studio-3.9.3-ga4 |
Prerequisite
Ready with Portal Server and Liferay Workspace.
Deploy and Run
Import Liferay Module in your Liferay Workspace. Run build
and deploy gradle tasks
Deploy module jar file in your OSGi deployment
directory by running gradle deploy task or also copy manually to “osgi\modules”
directory
.
Access Liferay Portal from Browser
|
Login as Liferay Admin
Create Page in Liferay and Add Widget (LiferayMessageBus)
to the page
Access “Send Message” screen.
Send Message with below UI screen. Message will be sent
to Message Bus on specified destination.
Once message sent on message bus then listeners will
be receiving the messages.
We can see the logs of listeners on console logs which
prints the message object. We will implemented listeners based on real time
requirements.
Access Destination Statistics UI screen.
Select Destination from dropdown, it will show the
statistics of destination.