No need, I had forgotten we already have an ApplicationReadyEvent :) (thanks ThomasM). Thanks -Vincent On Aug 28, 2013, at 2:22 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
I need to have an Event that I can subscribe to that tells me when the DB is ready. This is for the activeinstalls module. I'd like to start some Quartz job when the DB is ready (I'm getting the unique id from the DB).
Thus I'd like to introduce a new DatabaseReadyEvent that's sent in XWiki.initXWiki() at the end of the method:
… String syntaxes = Param("xwiki.rendering.syntaxes", "xwiki/1.0"); this.configuredSyntaxes = Arrays.asList(StringUtils.split(syntaxes, " ,"));
ObservationManager observationManager = Utils.getComponent((Type) ObservationManager.class); observationManager.addListener(this);
--> send the event here
…
Note that in the future we'll refactor DB initialization so that it's performed when XWiki starts rather than on the first request and we'll probably introduce a notion of init sequence and thus it'll probably be possible to just subscribe to Application Started Event with the proper sequence id. Or we'll introduce a ApplicationInitializer component role with the ability to say before or after which role it should execute (or use a priority).
However this is complex to achieve right now and I feel a DatabaseReadyEvent would fill the need in the meantime.
WDYT?
Thanks -Vincent