@@ -0,0 +1,1835 @@
+package org.jeecqrs.startup;%0A%0Aimport javax.annotation.PostConstruct;%0A%0A/**%0A * Orchestrates the initialization of the various infrastructure services.%0A * Deploy as @Startup @Singleton EJB.%0A */%0Apublic abstract class AbstractApplicationStartup %7B%0A%0A    @PostConstruct%0A    public void startup() %7B%0A        wireUpEventListeners();%0A        wireUpCommandHandlers();%0A        wireUpDispatchScheduler();%0A        wireUpSagaTracker();%0A        replayEvents();%0A        startDispatchScheduler();%0A        startSagaTracker();%0A    %7D%0A%0A    /**%0A     * Registers event handlers at the %7B@link EventDispatcher%7D.%0A     */%0A    protected abstract void wireUpEventListeners();%0A%0A    /**%0A     * Registers command handlers at the %7B@link CommandBus%7D.%0A     */%0A    protected abstract void wireUpCommandHandlers();%0A%0A    /**%0A     * Sets up the bridge between the %7B@link EventDispatcher%7D and the%0A     * persistence layer, such that newly persisted events are published%0A     * to the dispatcher.%0A     * Implementations might use polling or use an asynchronous listener%0A     * if the persistence implementations supports this.%0A     */%0A    protected abstract void wireUpDispatchScheduler();%0A%0A    /**%0A     * Sets up the %7B@link SagaTracker%7D to handle timed events in sagas.%0A     */%0A    protected abstract void wireUpSagaTracker();%0A%0A    /**%0A     * Replay persisted events on application startup.%0A     * Implementations should be aware of long transactions and timeouts.%0A     */%0A    protected abstract void replayEvents();%0A%0A    /**%0A     * Starts the %7B@link DispatchScheduler%7D, if required (asynchronous%0A     * implementations may not need this).%0A     */%0A    protected abstract void startDispatchScheduler();%0A%0A    /**%0A     * Starts the %7B@link SagaTracker%7D, if required (asynchronous%0A     * implementations may not need this).%0A     */%0A    protected abstract void startSagaTracker();%0A%0A%7D%0A

Add AbstractApplicationStartup to orchestrate the initialization of services