Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-29571

Allow registering runtime component listeners early

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 11.2
    • Fix Version/s: 11.3, 2021.0
    • Component/s: Runtime

      Description

      The ComponentManager service has 2 listener apis:

      • addComponentListener(ComponentListener) for components deployments events
      • addListener(ComponentManager.Listener) for runtime lifecycle hooks

      The first one is unused right now, and the second one is used:

      • by RuntimeMessageHandler, registering itself on the ComponentManager when created explicitly by the framework in it method Component#start
      • by components, in method Component#start

      The first, unused, listener registration would need to be done very early so that all component events are available to the listener.
      This cannot currently be ensured without registering a listener in the code, similarly to RuntimeMessageHandler, as any hook method like Component#activate or Component#start cannot be ensured to be called as "the first ones" when the framework starts.

      Goal is to make this pluggable by:

      • instantiating components
      • activating them in a second step

      This would be useful for explorer introspection logics, although registration and resolution of components happens earlier.

      When instantiating components, they can add themselves as listeners of the ComponentManager method.
      Note the listener addition methods check for duplicates, so it might not be necessary to unregister listeners at hot reload, but might be interesting to plug it on the component stop method, still (as component being hot-reloaded are instantiated again), for consistency.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h