Class DiscoveryModule

  • All Implemented Interfaces:
    com.google.inject.Module

    public class DiscoveryModule
    extends Object
    implements com.google.inject.Module
    The DiscoveryModule allows for the registration of Keys of DruidNode objects, which it intends to be automatically announced at the end of the lifecycle start. In order for this to work a ServiceAnnouncer instance *must* be injected and instantiated first. This can often be achieved by registering ServiceAnnouncer.class with the LifecycleModule.
    • Constructor Detail

      • DiscoveryModule

        public DiscoveryModule()
    • Method Detail

      • configure

        @Inject
        public void configure​(Properties properties)
      • registerDefault

        public static void registerDefault​(com.google.inject.Binder binder)
        Requests that the un-annotated DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle
        Parameters:
        binder - the Binder to register with
      • register

        public static void register​(com.google.inject.Binder binder,
                                    Annotation annotation)
        Requests that the annotated DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class, annotation)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle
        Parameters:
        annotation - The annotation instance to use in finding the DruidNode instance, usually a Named annotation
      • register

        public static void register​(com.google.inject.Binder binder,
                                    Class<? extends Annotation> annotation)
        Requests that the annotated DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class, annotation)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle
        Parameters:
        binder - the Binder to register with
        annotation - The annotation class to use in finding the DruidNode instance
      • registerKey

        public static void registerKey​(com.google.inject.Binder binder,
                                       com.google.inject.Key<DruidNode> key)
        Requests that the keyed DruidNode instance be injected and published as part of the lifecycle. That is, this module will announce the DruidNode instance returned by injector.getInstance(Key.get(DruidNode.class, annotation)) automatically. Announcement will happen in the ANNOUNCEMENTS stage of the Lifecycle
        Parameters:
        binder - the Binder to register with
        key - The key to use in finding the DruidNode instance
      • configure

        public void configure​(com.google.inject.Binder binder)
        Specified by:
        configure in interface com.google.inject.Module
      • getServiceDiscovery

        @Provides
        public org.apache.curator.x.discovery.ServiceDiscovery<Void> getServiceDiscovery​(org.apache.curator.framework.CuratorFramework curator,
                                                                                         CuratorDiscoveryConfig config,
                                                                                         org.apache.druid.java.util.common.lifecycle.Lifecycle lifecycle)
                                                                                  throws Exception
        Throws:
        Exception
      • getServerDiscoveryFactory

        @Provides
        public ServerDiscoveryFactory getServerDiscoveryFactory​(org.apache.curator.x.discovery.ServiceDiscovery<Void> serviceDiscovery)