Routing SPI: Default forwarding to the assigned upstream broker#118
Routing SPI: Default forwarding to the assigned upstream broker#118hrishabhg wants to merge 6 commits into
Conversation
Revises the Router plugin API (proposal 070) so a request on a broker-bound connection forwards to the broker that endpoint represents by default, and a router declares only the API keys it must intercept. Replaces staticRoutes(). Addresses the staticRoutes() gaps in kroxylicious#4177: the lost forward-to-assigned-broker default, the VC-level vs per-connection scope mismatch, and the unpopulatable key->route map. SPI: intercepts(apiKey, ctx) gate (default = bootstrap connections only), shouldDecodeRequest(apiKey, ctx) (default false), and onRequest(apiKey, RequestFrame, ctx). Response decode is lazy via ResponseFrame.body(); no shouldDecodeResponse and no onResponse callback. Route binding is established at connection-creation time, which keeps bound-connection forwarding unambiguous and permits multiple routes to one cluster. Relates-to: kroxylicious/kroxylicious#4177 Assisted-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
874d271 to
adaed91
Compare
|
Thanks for writing this up — and for pushing on I want to share a direction I've been thinking about as context. I haven't fully worked it out, so this isn't a counter-proposal — it's a lens I'd like us to evaluate the proposal through. The default destination for every request is the broker the connection already represents. That's the foundation I think we should be building on. I've been calling this "identity routing" in my head — every request has a default destination (the assigned broker), and routing is about when and why you deviate from that. Whether the identity router ends up as a concrete class, a runtime behaviour, or something else, I don't know yet. But the principle feels right: the assigned broker is always the answer unless something says otherwise. Under that lens, Where I'd like to push is whether the decode depth mechanics need to be part of this proposal or whether they're a follow-on. Thinking through each one against the same lens:
I'm not saying these are wrong. I'm asking whether they're separable from Is there a dependency I'm missing that ties the decode depth to the routing default? I've run out of time for a deeper look right now but will come back to this properly. |
Slims the proposal to the intercepts() gate per review feedback: drops shouldDecodeRequest and the RequestFrame/ResponseFrame lazy-decode abstractions, reverting onRequest and sendRequest to their 070 signatures. The DecodePredicate wiring stays, consulting intercepts() so that non-intercepted keys on bound connections are never decoded. Decode-depth optimisation of the interception path is recorded as follow-on work. Also updates the heading to the assigned proposal number (118). Relates-to: kroxylicious#118 Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
No dependency — I've slimmed the proposal to just the gate and moved decode depth to follow-on work. |
|
One more thought on the decode depth side, specifically lazy response decoding. Given the work in kroxylicious#4257, Fetch is the primary response by volume and size, and it's already decoded. So lazy |
Marks the routingMode metric categorisation as revisitable rather than fixed by this proposal. Reworks the gate-naming open question: drops the response-rewrite justification (that belongs to the route filter chain) and the claim that metric and method names need not match, adopting a single vocabulary as the goal while leaving the name choice to review. Relates-to: kroxylicious#118 Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
Response decoding is already driven by virtual node-id translation (kroxylicious#4257), Fetch included, leaving too narrow a case to justify widening sendRequest; the follow-on is now request-side decode depth only. The naming open question no longer ties itself to the unsettled metric vocabulary. Relates-to: kroxylicious#118 Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
Metrics are unreleased alongside 070, so the mapping is not a compatibility concern; categorisation follows once the SPI naming settles. Relates-to: kroxylicious#118 Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
The gate only changes request dispatch; response decoding stays governed by filters and node-id translation (kroxylicious#4257), so the sketch no longer models shouldDecodeResponse at all. Relates-to: kroxylicious#118 Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
@SamBarker Not much gain in the decode path due to nodeIdTranslation, agreed and removed from the proposal. Two version notes:
|
Revises the Router plugin API (proposal 070) so a request on a broker-bound connection forwards to the broker that endpoint represents by default, and a router declares only the API keys it must intercept. Replaces staticRoutes().
Addresses the staticRoutes() gaps in kroxylicious#4177: the lost forward-to-assigned-broker default, the VC-level vs per-connection scope mismatch, and the unpopulatable key->route map.
SPI: intercepts(apiKey, ctx) gate (default = bootstrap connections only), shouldDecodeRequest(apiKey, ctx) (default false), and onRequest(apiKey, RequestFrame, ctx). Response decode is lazy via ResponseFrame.body(); no shouldDecodeResponse and no onResponse callback. Route binding is established at connection-creation time, which keeps bound-connection forwarding unambiguous and permits multiple routes to one cluster.
Relates-to: kroxylicious/kroxylicious#4177
Assisted-by: Claude Opus 4.8 noreply@anthropic.com