Interface RouterFactory<C,I>

Type Parameters:
C - the configuration type, deserialized from the router's config property in the configuration file. Use Void if not configurable.
I - the initialisation data type

public interface RouterFactory<C,I>
A pluggable source of Router instances.

RouterFactories are service implementations called by the proxy runtime to create router instances. Each RouterFactory instance is scoped to a single virtual cluster.

The proxy runtime guarantees that:

  1. instances will be initialized before any attempt to create router instances,
  2. instances will eventually be closed if and only if they were successfully initialized,
  3. no attempts to create router instances will be made once a RouterFactory instance is closed,
  4. instances will be initialized and closed on the same thread.

Per-connection router instances: createRouter(io.kroxylicious.proxy.router.RouterFactoryContext, I) is called once per client connection, so each connection gets its own Router instance. Any state that must survive a client disconnect and reconnect (e.g. producer ID mappings) must be stored in the shared initialisation data I, not in the Router instance itself.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    close(I initializationData)
    Releases resources associated with the given initialisation data.
    createRouter(RouterFactoryContext context, I initializationData)
    Creates a new router instance.
    initialize(RouterFactoryContext context, C config)
    Initializes the factory with the given configuration.