Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-2827

discovery.impl: a resource based implementation of the discovery.api


    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Discovery Impl 1.0.0
    • Component/s: Extensions
    • Labels:


      This ticket is about contributing a resource based implementation of the discovery api (see [0]) named discovery.impl to Sling. The implementation is attached as a .tar.gz - its md5 hash is d8891e5401114b2a629d3ff01044a1d6

      Short description of the discovery.impl:

      The discovery.impl is an out-of-the-box implementation of the discovery.api using standard features of Sling. The discovery.api provides a view of a topology consisting of a number of individual sling-instances. The instances are loosely coupled, except for being part of the topology they do not implicitly or necessarily share anything else. For those instances though that form a cluster - ie when connected to the same repository - the api has an abstraction called ClusterView.

      The discovery.impl uses two mechanisms for discovering other instances:

      • it stores information about the local instance at a unique location in the repository. Thus allowing other instances that access the same repository to see and recognize each other.
      • it connects to 'remote' instances via a plain HTTP POST, announcing the instances that it can see, and getting back the instances of the counterpart

      All of the above is done regularly using a heart-beat - thus allowing to get a view of the currently live instances.

      The discovery.api additionally supports leader-election within a cluster: it ensures that one and only one instance is elected leader and stays leader until it disappears/shuts down/dies. The discovery.impl uses repository-based voting between the instances of a cluster to establish a common 'cluster view'. Based on an established view, the discovery.impl is then able to deterministically elect one of the instances of the view as the leader (namely the one with the lowest 'id').

      Also, to support the PropertyProvider concept of the discovery.api, the properties of each instance are propagated to the other instances using the heartbeat as piggyback (either via the repository or via HTTP POSTs for remote instances).

      To get an idea of the discovery.impl build and add and start the two bundles (org.apache.sling.discovery.api and org.apache.sling.discovery.impl) to your sling installation and open the browser to the provided, simplistic 'topology webconsole' at


      Please let me know if anything needs further explanation, details. Looking forward to having this included in Sling!


      [0] http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/discovery/api


        1. discovery.impl.activate_and_changing.patch
          7 kB
          Stefan Egli
        2. discovery.impl.bootstrap.patch
          4 kB
          Stefan Egli
        3. discovery.impl.loops.timeouts.webconsole.patch
          52 kB
          Stefan Egli
        4. discovery.impl.svn.patch
          75 kB
          Stefan Egli
        5. discovery.impl.tar.gz
          47 kB
          Stefan Egli



            • Assignee:
              cziegeler Carsten Ziegeler
              egli Stefan Egli
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: