Foros de discusión
How to implement Startup Action Hook in LIferay DXP?
Kushagra Khanna, modificado hace 6 años.
How to implement Startup Action Hook in LIferay DXP?
Junior Member Mensajes: 45 Fecha de incorporación: 28/12/14 Mensajes recientes
Hi Team,
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
Regards,
Kushagra
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
Regards,
Kushagra
Olaf Kock, modificado hace 6 años.
RE: How to implement Startup Action Hook in LIferay DXP?
Liferay Legend Mensajes: 6396 Fecha de incorporación: 23/09/08 Mensajes recientesKushagra Khanna:
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
You'd go for a lifecycle action. Here's a sample in a module. Check the blade-sample readme for alternative properties, to change it from a login action to another lifecycle action.
asif aftab, modificado hace 3 años.
RE: How to implement Startup Action Hook in LIferay DXP?
Regular Member Mensajes: 123 Fecha de incorporación: 2/09/13 Mensajes recientes
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;import org.osgi.service.component.annotations.Component;@Component(
immediate = true,
property = {
"key=application.startup.events"
},
service = LifecycleAction.class
)
public class CustomStartupAction extends SimpleAction{ private static final Log _log = LogFactoryUtil.getLog(CustomStartupAction .class);
@Override
public void run(String[] ids) throws ActionException { _log.info("----------------------------only on startup of server -------------------------------");
}}
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;import org.osgi.service.component.annotations.Component;@Component(
immediate = true,
property = {
"key=application.startup.events"
},
service = LifecycleAction.class
)
public class CustomStartupAction extends SimpleAction{ private static final Log _log = LogFactoryUtil.getLog(CustomStartupAction .class);
@Override
public void run(String[] ids) throws ActionException { _log.info("----------------------------only on startup of server -------------------------------");
}}
David H Nebinger, modificado hace 3 años.
RE: How to implement Startup Action Hook in LIferay DXP?
Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
An easier solution may be to use an @Activate annotated method. This will run every time the bundle starts so you get it for initial portal startup, deployment, etc.
asif aftab, modificado hace 3 años.
RE: How to implement Startup Action Hook in LIferay DXP?
Regular Member Mensajes: 123 Fecha de incorporación: 2/09/13 Mensajes recientes
Thank you so much
I will try this
I will try this