My scenario is the next one, I want to get the current state of the portlets availables in the liferay portal, but the main idea is to generate a chart or some graphic resource and fill it with the information of the exact timestamp when the portlet started to being deployed and the timestamp when the portlet is fully loaded into the portal, right now I don't know how can I get these timestamps, I tried to read it from the catalina.out but for my project leader is not correct to do that. thank you in advanced
You have two options, create a HotDeployListener or listen to messagebus HOT_DEPLOY messages
When a portlet or any other plugin is deployed, Liferay executes a list of HotDeployListener listeners that are defined in hot.deploy.listeners
property of portal.properties
See default value in Hot Deploy section of portal.properties
The hot deploy listener receives a HotDeployEvent
object that contains information about portlet is being deployed, for example servletcontext can be retrieved
You have to implement your own HotDeployListener
, see javadoc documentation and add it your portal-ext.properties.
You have to copy the default value of hot.deploy.listeners
property to your portal-ext.properties and add to that list yours listener.
For more information see documentation in portal.properties file:
Input a list of comma delimited class names that implement com.liferay.portal.kernel.deploy.hot.HotDeployListener. These classes are used to process the deployment and undeployment of WARs at runtime.
The listeners are invoked in the order defined by this property. PluginPackageHotDeployListener must always be invoked first. SpringHotDeployListener must always be invoked before ServletContextListenerHotDeployListener. MessagingHotDeployListener must always be invoked last.
After portlet is deployed, a HOT_DEPLOY message is sent to Liferay message bus by the MessagingHotDeployListener, see: portal-impl/src/com/liferay/portal/deploy/hot/MessagingHotDeployListener.java#L70-L75
You can listen to that event creating a listener and call to MessageBusUtil.registerMessageListener(DestinationNames.HOT_DEPLOY, myListener)
or MessageBusUtil.registerMessageListener("liferay/hot_deploy", myListener)
.
The listener must implement MessageListener
interface, see javadoc documentation
For more information about Liferay messagebus see following links:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.