Class DiscoveryModule
java.lang.Object
org.apache.druid.curator.discovery.DiscoveryModule
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(com.google.inject.Binder binder) voidconfigure(Properties properties) getServerDiscoveryFactory(org.apache.curator.x.discovery.ServiceDiscovery<Void> serviceDiscovery) getServiceAnnouncer(CuratorServiceAnnouncer announcer, com.google.inject.Injector injector, Set<KeyHolder<DruidNode>> nodesToAnnounce, Lifecycle lifecycle) org.apache.curator.x.discovery.ServiceDiscovery<Void>getServiceDiscovery(org.apache.curator.framework.CuratorFramework curator, CuratorDiscoveryConfig config, Lifecycle lifecycle) static voidregister(com.google.inject.Binder binder, Annotation annotation) Requests that the annotated DruidNode instance be injected and published as part of the lifecycle.static voidregister(com.google.inject.Binder binder, Class<? extends Annotation> annotation) Requests that the annotated DruidNode instance be injected and published as part of the lifecycle.static voidregisterDefault(com.google.inject.Binder binder) Requests that the un-annotated DruidNode instance be injected and published as part of the lifecycle.static voidregisterKey(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.
-
Constructor Details
-
DiscoveryModule
public DiscoveryModule()
-
-
Method Details
-
configure
-
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
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 withannotation- 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 withkey- The key to use in finding the DruidNode instance
-
configure
public void configure(com.google.inject.Binder binder) - Specified by:
configurein interfacecom.google.inject.Module
-
getServiceAnnouncer
@Provides public CuratorServiceAnnouncer getServiceAnnouncer(CuratorServiceAnnouncer announcer, com.google.inject.Injector injector, Set<KeyHolder<DruidNode>> nodesToAnnounce, Lifecycle lifecycle) throws Exception - Throws:
Exception
-
getServiceDiscovery
@Provides public org.apache.curator.x.discovery.ServiceDiscovery<Void> getServiceDiscovery(org.apache.curator.framework.CuratorFramework curator, CuratorDiscoveryConfig config, Lifecycle lifecycle) throws Exception - Throws:
Exception
-
getServerDiscoveryFactory
@Provides public ServerDiscoveryFactory getServerDiscoveryFactory(org.apache.curator.x.discovery.ServiceDiscovery<Void> serviceDiscovery)
-