com.linkedin.d2.contrib
Class RouteLookupClient

java.lang.Object
  extended by com.linkedin.d2.contrib.RouteLookupClient
All Implemented Interfaces:
RoutingAwareClient

public class RouteLookupClient
extends java.lang.Object
implements RoutingAwareClient

RouteLookupClient can be used to send normal RestRequests as well as request that require a RouteLookup. A RouteLookup can do any action, as long as they implement the interface. Currently, only RestRequests are supported in RouteLookupClient when using a RouteLookup.


Constructor Summary
RouteLookupClient(com.linkedin.r2.transport.common.Client client, RouteLookup routeLookup, java.lang.String routingGroup)
           
 
Method Summary
 void restRequest(com.linkedin.r2.message.rest.RestRequest request, com.linkedin.common.callback.Callback<com.linkedin.r2.message.rest.RestResponse> callback, java.lang.String routeKey)
          This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request.
 void restRequest(com.linkedin.r2.message.rest.RestRequest request, com.linkedin.r2.message.RequestContext requestContext, com.linkedin.common.callback.Callback<com.linkedin.r2.message.rest.RestResponse> callback, java.lang.String routeKey)
          This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request.
 java.util.concurrent.Future<com.linkedin.r2.message.rest.RestResponse> restRequest(com.linkedin.r2.message.rest.RestRequest request, com.linkedin.r2.message.RequestContext requestContext, java.lang.String routekey)
          This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request.
 java.util.concurrent.Future<com.linkedin.r2.message.rest.RestResponse> restRequest(com.linkedin.r2.message.rest.RestRequest request, java.lang.String routeKey)
          This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouteLookupClient

public RouteLookupClient(com.linkedin.r2.transport.common.Client client,
                         RouteLookup routeLookup,
                         java.lang.String routingGroup)
Method Detail

restRequest

public void restRequest(com.linkedin.r2.message.rest.RestRequest request,
                        com.linkedin.common.callback.Callback<com.linkedin.r2.message.rest.RestResponse> callback,
                        java.lang.String routeKey)
Description copied from interface: RoutingAwareClient
This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request. An example routeKey might be a memberID. It is up to the implementation to convert the routeKey into the correct d2 service name.

Specified by:
restRequest in interface RoutingAwareClient
Parameters:
request - original rest request
callback - used to return the new service name.
routeKey - key used to determine a new service name.

restRequest

public void restRequest(com.linkedin.r2.message.rest.RestRequest request,
                        com.linkedin.r2.message.RequestContext requestContext,
                        com.linkedin.common.callback.Callback<com.linkedin.r2.message.rest.RestResponse> callback,
                        java.lang.String routeKey)
Description copied from interface: RoutingAwareClient
This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request. An example routeKey might be a memberID. It is up to the implementation to convert the routeKey into the correct d2 service name.

Specified by:
restRequest in interface RoutingAwareClient
Parameters:
request - original rest request
requestContext - request context
callback - used to return the new service name.
routeKey - key used to determine a new service name.

restRequest

public java.util.concurrent.Future<com.linkedin.r2.message.rest.RestResponse> restRequest(com.linkedin.r2.message.rest.RestRequest request,
                                                                                          java.lang.String routeKey)
Description copied from interface: RoutingAwareClient
This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request. An example routeKey might be a memberID. It is up to the implementation to convert the routeKey into the correct d2 service name. The returned Future can be used to retrieve the RestResponse.

Specified by:
restRequest in interface RoutingAwareClient
Parameters:
request - original rest request
routeKey - key used to determine a new service name.
Returns:
a future to wait for the response

restRequest

public java.util.concurrent.Future<com.linkedin.r2.message.rest.RestResponse> restRequest(com.linkedin.r2.message.rest.RestRequest request,
                                                                                          com.linkedin.r2.message.RequestContext requestContext,
                                                                                          java.lang.String routekey)
Description copied from interface: RoutingAwareClient
This function can be used to send a restRequest with an additional routeKey to determine the appropriate d2 service to use for routing the request. An example routeKey might be a memberID. It is up to the implementation to convert the routeKey into the correct d2 service name. The returned Future can be used to retrieve the RestResponse.

Specified by:
restRequest in interface RoutingAwareClient
Parameters:
request - original rest request
requestContext - request context
routekey - key used to determine a new service name.
Returns:
a future to wait for the response