Class InProcessGrpcChannelFactory

java.lang.Object
org.springframework.grpc.client.DefaultGrpcChannelFactory<io.grpc.inprocess.InProcessChannelBuilder>
org.springframework.grpc.client.InProcessGrpcChannelFactory
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, GrpcChannelFactory

public class InProcessGrpcChannelFactory extends DefaultGrpcChannelFactory<io.grpc.inprocess.InProcessChannelBuilder>
GrpcChannelFactory that creates in-process gRPC channels.
Author:
Chris Bono
  • Constructor Details

    • InProcessGrpcChannelFactory

      public InProcessGrpcChannelFactory(List<GrpcChannelBuilderCustomizer<io.grpc.inprocess.InProcessChannelBuilder>> globalCustomizers, ClientInterceptorsConfigurer interceptorsConfigurer)
      Construct an in-process channel factory instance and sets the virtualTargets to the identity function so that the exact passed in target string is used as the target of the channel factory.
      Parameters:
      globalCustomizers - the global customizers to apply to all created channels
      interceptorsConfigurer - configures the client interceptors on the created channels
  • Method Details

    • supports

      public boolean supports(String target)
      Whether this factory supports the given target string.

      The target can be either a valid nameresolver-compliant URI or an authority string as described in Grpc.newChannelBuilder(String, ChannelCredentials), or the name of a user-configured channel (e.g. 'my-channel').

      Specified by:
      supports in interface GrpcChannelFactory
      Overrides:
      supports in class DefaultGrpcChannelFactory<io.grpc.inprocess.InProcessChannelBuilder>
      Parameters:
      target - the target string
      Returns:
      true if the target begins with 'in-process:'
    • newChannelBuilder

      protected io.grpc.inprocess.InProcessChannelBuilder newChannelBuilder(String target, io.grpc.ChannelCredentials creds)
      Description copied from class: DefaultGrpcChannelFactory
      Creates a new ManagedChannelBuilder instance for the given target and credentials. The target is a valid nameresolver-compliant URI or an authority string as described in Grpc.newChannelBuilder(String, ChannelCredentials).
      Overrides:
      newChannelBuilder in class DefaultGrpcChannelFactory<io.grpc.inprocess.InProcessChannelBuilder>
      Parameters:
      target - the target of the channel
      creds - the credentials for the channel
      Returns:
      a new builder for the given target and credentials