Interface DiscoveryContext<T>
- All Known Implementing Classes:
GenericDiscoveryContext
,IntegerDiscoveryContext
,MapDiscoveryContext
,StringDiscoveryContext
public interface DiscoveryContext<T>
Bridge between the specifics of your needs and the generic implementation
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the threshold in milliseconds to consider a registration staleReturn the provider strategy to use forDiscoveryResource.getAny(String)
Return the service singletonvoid
marshallJson
(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, T payload) Serialize your payloadunMarshallJson
(com.fasterxml.jackson.databind.JsonNode node) Deserialize your payload
-
Method Details
-
getInstanceRefreshMs
int getInstanceRefreshMs()Return the threshold in milliseconds to consider a registration stale- Returns:
- number of milliseconds
-
getServiceDiscovery
ServiceDiscovery<T> getServiceDiscovery()Return the service singleton- Returns:
- service
-
marshallJson
void marshallJson(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, T payload) throws Exception Serialize your payload- Parameters:
node
- the node to serialize intofieldName
- field name to usepayload
- the payload value (can be null)- Throws:
Exception
- any errors
-
unMarshallJson
Deserialize your payload- Parameters:
node
- the node that has the payload- Returns:
- the payload or null
- Throws:
Exception
- any errors
-
getProviderStrategy
ProviderStrategy<T> getProviderStrategy()Return the provider strategy to use forDiscoveryResource.getAny(String)
- Returns:
- strategy
-