Class InProcessOrAlternativeChannelFactory

java.lang.Object
net.devh.boot.grpc.client.channelfactory.InProcessOrAlternativeChannelFactory
All Implemented Interfaces:
AutoCloseable, GrpcChannelFactory

public class InProcessOrAlternativeChannelFactory extends Object implements GrpcChannelFactory
This channel factory is a switch between the InProcessChannelFactory and an alternative implementation. All channels that are configured with the in-process scheme will be handled by the in-process-channel-factory, the other channels will be handled by the alternative implementation.

The following examples show how the configured address will be mapped to an actual channel:

  • in-process:foobar -> will use the foobar in-process-channel.
  • in-process:foo/bar -> will use the foo/bar in-process-channel.
  • static://127.0.0.1 -> will be handled by the alternative grpc channel factory.

Using this class does not incur any additional performance or resource costs, as the actual channels (in-process or other) are only created on demand.

  • Constructor Details

    • InProcessOrAlternativeChannelFactory

      public InProcessOrAlternativeChannelFactory(GrpcChannelsProperties properties, InProcessChannelFactory inProcessChannelFactory, GrpcChannelFactory alternativeChannelFactory)
      Creates a new InProcessOrAlternativeChannelFactory with the given properties and channel factories.
      Parameters:
      properties - The properties used to resolved the target scheme
      inProcessChannelFactory - The in process channel factory implementation to use.
      alternativeChannelFactory - The alternative channel factory implementation to use.
  • Method Details