Skip to main content

kafka-proxy

Carries the SASL credentials a Kafka upstream is dialled with.

Category Other protocolsAdd it to Route, Service, Consumer, Consumer group, Global rule, Plugin configEngine plugin kafka-proxyPriority 508

What it does​

kafka-proxy holds the SASL username and password the gateway signs in to Kafka brokers with, under SASL. It acts on a route whose upstream speaks Kafka, with the scheme kafka, through the gateway's pub/sub bridge.

On any other route the plugin runs and nothing reads the username and password, so a route that does not speak Kafka signs in nowhere.

When to use it​

  • A web app reads order events from the orders team's Kafka topics through the gateway, and the brokers take only signed-in users.
  • The Kafka team gives the gateway a user of its own, gateway, so its reads are told apart from those of other services.
  • The password of the gateway's Kafka user changes, and the route must sign in with the new one.

Not for sending request records to a Kafka topic — see kafka-logger (Sends request logs to a Kafka topic).

Set it up​

Sign in to the Kafka brokers with a SASL username and password​

Acts only on a route whose upstream speaks Kafka, with scheme kafka.

Fill SASL as in the JSON below.

kafka-proxy · as the console saves it
{
"sasl": {
"username": "gateway",
"password": "<secret>"
}
}

Things to know​

  • SASL — Only read on a route whose upstream scheme is kafka. On any other route the plugin runs and nothing uses them.
  • SASL — Both halves are needed: a SASL without a Password is refused when you save.
  • SASL — A SASL without a Username is refused when you save.
  • AdviceGive the gateway a Kafka user of its own, allowed to read only the topics its routes offer.

Settings​

The fields as the console shows them, section by section.

SASLsaslobject
Usernamesasl.usernamestringRequired
Passwordsasl.passwordstringRequired

The SASL password of the Kafka user above. Stored on the engine and shown only to roles that manage this object.

Every plugin also has Enabled, Priority, Filter, Error response and Pre-function: see Plugin execution settings.

G8 dev · Apache APISIX® 3.19.0
Apache, Apache APISIX and APISIX are trademarks of The Apache Software Foundation.
Facts
Category
Other protocols
Add it to
Route, Service, Consumer, Consumer group, Global rule, Plugin config
Engine plugin
kafka-proxy
Priority
508