留言板
Hook - global. startup. events
Hi,
i have tryed use custom global.startup.events in my hook. I have followed book Liferay Portal Systems Development Second Edition. My hook consist of:
liferay-hook.xml
portal.properties
but my action is not executed on server startup so i decided to debug code. At time when MainServlet calls processGlobalStartupEvents() global.startup.events = com.liferay.portal.events.GlobalStartupAction and only GlobalStartupAction is executed. Ok, then i decided to debug HookHotDeployListener mabe event will be executed there. At the first look global.startup.events is not present in SUPPORTED_PROPERTIES. When i go throught HookHotDeployListener i havent find any global.startup.events hanler.
Can anyone tell me what I missed?
i have tryed use custom global.startup.events in my hook. I have followed book Liferay Portal Systems Development Second Edition. My hook consist of:
liferay-hook.xml
<!--?xml version="1.0"?-->
<hook>
<portal-properties>portal.properties</portal-properties>
</hook>
portal.properties
global.startup.events=com.liferay.sandbox.SandboxInitializationAction
but my action is not executed on server startup so i decided to debug code. At time when MainServlet calls processGlobalStartupEvents() global.startup.events = com.liferay.portal.events.GlobalStartupAction and only GlobalStartupAction is executed. Ok, then i decided to debug HookHotDeployListener mabe event will be executed there. At the first look global.startup.events is not present in SUPPORTED_PROPERTIES. When i go throught HookHotDeployListener i havent find any global.startup.events hanler.
Can anyone tell me what I missed?
You can use
application.startup.events instead of global.startup.events
if you need your custom event to be started when your hook applicaton is deployed.
Vitaliy
application.startup.events instead of global.startup.events
if you need your custom event to be started when your hook applicaton is deployed.
Vitaliy
Andrew Jardine,修改在8 年前。
RE: Hook - global. startup. events
Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
One thing to note for this though is that in a multi-tenant environment (where you are using portal instances) the hook will run for EVERY instance when you use the application one. If you use the global one, then it will only run once. Unfortunately, I don't beleive that the global events are "hookable". I think y ou have to configure those in your portal-ext (or derivative) and make sure that the class is part of the classpath.
Alternatively, you could scope your hook to only run for the default instance using a little additional logic in the hook itself.
Alternatively, you could scope your hook to only run for the default instance using a little additional logic in the hook itself.