io.dropwizard.discovery.DiscoveryBundle Maven / Gradle / Ivy
package io.dropwizard.discovery;
import io.dropwizard.Configuration;
import io.dropwizard.discovery.core.CuratorAdvertiser;
import io.dropwizard.discovery.core.DefaultServiceInstanceFactory;
import io.dropwizard.discovery.core.InstanceMetadata;
import io.dropwizard.discovery.core.ServiceInstanceFactory;
import org.apache.curator.x.discovery.ServiceDiscovery;
/**
* DiscoveryBundle
provides a more completed implementation of
* AbstractDiscoveryBundle
, using InstanceMetadata
as
* payload for ServiceInstance
*
*
* Users should extend AbstractDiscoveryBundle
if more fine-grain
* control is necessary of the ServiceInstance
payload.
*
*
* @see io.dropwizard.discovery.core.InstanceMetadata
* @see io.dropwizard.discovery.DiscoveryBundle
*/
public abstract class DiscoveryBundle extends
AbstractDiscoveryBundle {
private final static ServiceInstanceFactory serviceInstanceFactory = new DefaultServiceInstanceFactory();
@Override
public CuratorAdvertiser getCuratorAdvertiser(
DiscoveryFactory discoveryConfig,
ServiceDiscovery discovery) {
return new CuratorAdvertiser(discoveryConfig,
discovery, serviceInstanceFactory);
}
@Override
public Class getPayloadClass() {
return serviceInstanceFactory.getPayloadClass();
}
}