Class GlobalClientInterceptorRegistry

java.lang.Object
net.devh.boot.grpc.client.interceptor.GlobalClientInterceptorRegistry

public class GlobalClientInterceptorRegistry extends Object
The global client interceptor registry keeps references to all ClientInterceptors that should be registered to all client channels. The interceptors will be applied in the same order they as specified by the sortInterceptors(List) method.

Note: Custom interceptors will be appended to the global interceptors and applied using ClientInterceptors.interceptForward(Channel, ClientInterceptor...).

  • Constructor Details

    • GlobalClientInterceptorRegistry

      public GlobalClientInterceptorRegistry(ApplicationContext applicationContext)
      Creates a new GlobalClientInterceptorRegistry.
      Parameters:
      applicationContext - The application context to fetch the GlobalClientInterceptorConfigurer beans from.
  • Method Details

    • getClientInterceptors

      public ImmutableList<ClientInterceptor> getClientInterceptors()
      Gets the immutable list of global server interceptors.
      Returns:
      The list of globally registered server interceptors.
    • initClientInterceptors

      protected List<ClientInterceptor> initClientInterceptors()
      Initializes the list of client interceptors.
      Returns:
      The list of global client interceptors.
    • sortInterceptors

      public void sortInterceptors(List<? extends ClientInterceptor> interceptors)
      Sorts the given list of interceptors. Use this method if you want to sort custom interceptors. The default implementation will sort them by using then AnnotationAwareOrderComparator.
      Parameters:
      interceptors - The interceptors to sort.