Class StringDiscoveryContext
java.lang.Object
org.apache.curator.x.discovery.server.contexts.StringDiscoveryContext
- All Implemented Interfaces:
 javax.ws.rs.ext.ContextResolver<DiscoveryContext<String>>,DiscoveryContext<String>
@Provider
public class StringDiscoveryContext
extends Object
implements DiscoveryContext<String>, javax.ws.rs.ext.ContextResolver<DiscoveryContext<String>>
For convenience, a version of 
DiscoveryContext that uses a string as the
 payload- 
Constructor Summary
ConstructorsConstructorDescriptionStringDiscoveryContext(ServiceDiscovery<String> serviceDiscovery, ProviderStrategy<String> providerStrategy, int instanceRefreshMs)  - 
Method Summary
Modifier and TypeMethodDescriptiongetContext(Class<?> type) intReturn the threshold in milliseconds to consider a registration staleReturn the provider strategy to use forDiscoveryResource.getAny(String)Return the service singletonvoidmarshallJson(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, String payload) Serialize your payloadunMarshallJson(com.fasterxml.jackson.databind.JsonNode node) Deserialize your payload 
- 
Constructor Details
- 
StringDiscoveryContext
public StringDiscoveryContext(ServiceDiscovery<String> serviceDiscovery, ProviderStrategy<String> providerStrategy, int instanceRefreshMs)  
 - 
 - 
Method Details
- 
getProviderStrategy
Description copied from interface:DiscoveryContextReturn the provider strategy to use forDiscoveryResource.getAny(String)- Specified by:
 getProviderStrategyin interfaceDiscoveryContext<String>- Returns:
 - strategy
 
 - 
getInstanceRefreshMs
public int getInstanceRefreshMs()Description copied from interface:DiscoveryContextReturn the threshold in milliseconds to consider a registration stale- Specified by:
 getInstanceRefreshMsin interfaceDiscoveryContext<String>- Returns:
 - number of milliseconds
 
 - 
getServiceDiscovery
Description copied from interface:DiscoveryContextReturn the service singleton- Specified by:
 getServiceDiscoveryin interfaceDiscoveryContext<String>- Returns:
 - service
 
 - 
marshallJson
public void marshallJson(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, String payload) throws Exception Description copied from interface:DiscoveryContextSerialize your payload- Specified by:
 marshallJsonin interfaceDiscoveryContext<String>- Parameters:
 node- the node to serialize intofieldName- field name to usepayload- the payload value (can be null)- Throws:
 Exception- any errors
 - 
unMarshallJson
Description copied from interface:DiscoveryContextDeserialize your payload- Specified by:
 unMarshallJsonin interfaceDiscoveryContext<String>- Parameters:
 node- the node that has the payload- Returns:
 - the payload or null
 - Throws:
 Exception- any errors
 - 
getContext
- Specified by:
 getContextin interfacejavax.ws.rs.ext.ContextResolver<DiscoveryContext<String>>
 
 -