Record Class DynamicRouting
java.lang.Object
java.lang.Record
io.kroxylicious.proxy.internal.routing.DynamicRouting
- All Implemented Interfaces:
RoutingModel,AutoCloseable
public record DynamicRouting(String routerName, Map<String,RouteDescriptor> routeDescriptors, NodeIdMapping nodeIdMapping, RouterChainFactory routerChainFactory, Map<String,UpstreamClusterModel> routeClusterModels)
extends Record
implements RoutingModel
Routing model for a virtual cluster that forwards to one or more upstream clusters via a named
router plugin. The
NodeIdMapping is derived from the route descriptors at construction
time. The RouterChainFactory is owned by this instance and is closed when the owning
VirtualClusterModel is closed.
Owns per-route UpstreamClusterModel instances in routeClusterModels(), which are
populated from route descriptors during VirtualClusterModel construction. An empty map is
used when no TLS resources have been resolved (e.g. in test contexts without a
PluginFactoryRegistry).
-
Constructor Summary
ConstructorsConstructorDescriptionDynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, RouterChainFactory routerChainFactory) Test-only constructor: uses an empty cluster model map.DynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, RouterChainFactory routerChainFactory, Map<String, UpstreamClusterModel> routeClusterModels) Production constructor: computes theNodeIdMappingfrom the supplied route descriptors.DynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, NodeIdMapping nodeIdMapping, RouterChainFactory routerChainFactory, Map<String, UpstreamClusterModel> routeClusterModels) Creates an instance of aDynamicRoutingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()io.kroxylicious.proxy.router.RoutercreateRouter(String clusterName) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenodeIdMappingrecord component.Returns the value of therouteClusterModelsrecord component.Returns the value of therouteDescriptorsrecord component.Returns the value of therouterChainFactoryrecord component.Returns the value of therouterNamerecord component.final StringtoString()Returns a string representation of this record class.upstreamClusterFor(String routeName) Returns theUpstreamClusterModelfor the given route name
-
Constructor Details
-
DynamicRouting
public DynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, RouterChainFactory routerChainFactory, Map<String, UpstreamClusterModel> routeClusterModels) Production constructor: computes theNodeIdMappingfrom the supplied route descriptors. -
DynamicRouting
@VisibleForTesting public DynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, RouterChainFactory routerChainFactory) Test-only constructor: uses an empty cluster model map. Production code should supply fully-builtUpstreamClusterModelinstances. -
DynamicRouting
public DynamicRouting(String routerName, Map<String, RouteDescriptor> routeDescriptors, NodeIdMapping nodeIdMapping, RouterChainFactory routerChainFactory, Map<String, UpstreamClusterModel> routeClusterModels) Creates an instance of aDynamicRoutingrecord class.- Parameters:
routerName- the value for therouterNamerecord componentrouteDescriptors- the value for therouteDescriptorsrecord componentnodeIdMapping- the value for thenodeIdMappingrecord componentrouterChainFactory- the value for therouterChainFactoryrecord componentrouteClusterModels- the value for therouteClusterModelsrecord component
-
-
Method Details
-
createRouter
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRoutingModel
-
upstreamClusterFor
Description copied from interface:RoutingModelReturns theUpstreamClusterModelfor the given route name- Specified by:
upstreamClusterForin interfaceRoutingModel
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
routerName
Returns the value of therouterNamerecord component.- Returns:
- the value of the
routerNamerecord component
-
routeDescriptors
Returns the value of therouteDescriptorsrecord component.- Returns:
- the value of the
routeDescriptorsrecord component
-
nodeIdMapping
Returns the value of thenodeIdMappingrecord component.- Returns:
- the value of the
nodeIdMappingrecord component
-
routerChainFactory
Returns the value of therouterChainFactoryrecord component.- Returns:
- the value of the
routerChainFactoryrecord component
-
routeClusterModels
Returns the value of therouteClusterModelsrecord component.- Returns:
- the value of the
routeClusterModelsrecord component
-