Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With the same philosophy as the prior concept, rationale and goals are not listed here but the design and implementation will be mentioned to align with Magnolia 5.6. Also over long time usage, customers having more and more demand on start / stop / install / uninstall a module, the needs has been increased while the technology has been updated. This allow us to easier achieve this goal in comparison to previous versions.

An overview of implementation looks like below:

Image Added

Most of the design and implementation focused in ModuleManager where Magnolia control its modules and components. Let's start with an easiest function uninstalling a module design.

...


Start / stop module

With traditional Mangolia Magnolia modules, we didn't really put our attentions to Module lifecycle management which means we didn't really implemented module 'start' and 'stop' function. However it is fully supported and in some cases, customers might want to implement them to support them persist of their critical information. Currently the start and stop just call corresponding functions of the modules.

...

Now let's go the difficult part - change module manager to support installing a new module on the fly.

TO BE IMPROVED:

  • consider whether not providing restart actions instead of start/stop. As stopping some module might mean that system will not work correctly and module "downtime" should be minimized.
  • and last but not least consider that on restart (or stop) you should restart (or stop) all modules that have declared dependency on given module in a cascade.

Installing a module

Design

...

Just prevent exception propagation by catch it here and by it pass to continue running:

Code Block
languagejava
collapsetrue
    protected void installOrUpdateModule(ModuleAndDeltas moduleAndDeltas, InstallContextImpl ctx) {
        final ModuleDefinition moduleDef = moduleAndDeltas.getModule();
        final List<Delta> deltas = moduleAndDeltas.getDeltas();
        ctx.setCurrentModule(moduleDef);
        log.debug("Install/update for {} is starting: {}", moduleDef, moduleAndDeltas);
        // viet fix continue running after fail install
        try {
            applyDeltas(moduleDef, deltas, ctx);
        } catch (Exception e) {
            log.error("Install module {} failed {}.", moduleDef.getName(), e.getMessage(), e);
        }
        log.debug("Install/update for {} has finished", moduleDef, moduleAndDeltas);
    }

...