com.linkedin.d2.contrib
Interface RouteLookup


public interface RouteLookup

This interface is meant to be used in conjunction with a client that implements RoutingAwareClient. This can be used when the correct d2 service name to route a request to is not known immediately without additional action. For example, userA may map to serviceA, and userB maps to serviceB. In this case, the userid can be used as the routeKey to make either an in memory decision or an out of band call to determine what service name to return through the callback.


Method Summary
 void run(java.lang.String originalServiceName, java.lang.String location, java.lang.String routeKey, com.linkedin.common.callback.Callback<java.lang.String> callback)
          This function can be used to return a different service name than the original service name.
 

Method Detail

run

void run(java.lang.String originalServiceName,
         java.lang.String location,
         java.lang.String routeKey,
         com.linkedin.common.callback.Callback<java.lang.String> callback)
This function can be used to return a different service name than the original service name. The two primary inputs to modifying the original service name can be location and/or routeKey. The new service name (as string) is returned through the Callback. The implementation can do any action needed to return the new service name. This is a non-blocking interface.

Parameters:
originalServiceName - original service name
location - destination descriptor, if needed
routeKey - key used to determine a new service name.
callback - used to return the new service name.