Send messages to multiple topicsv3.10+

As of Kong Gateway 3.10, the Kafka Upstream plugin supports sending messages to multiple Kafka topics specified by the client through a query parameter. To control which topics clients can target, you can configure an allowlist of permitted topic names.

Clients can use the topic-list query parameter to send a message to one or more topics. These can include topics listed in the allowed_topic configuration, as well as the default topic specified in the topic field.

Example: curl http://localhost:8000/kafka?topic-list=my-topic,topic1

Environment variables

  • KAFKA_TOPIC: The name of your Kafka topic

Set up the plugin

Add this section to your declarative configuration file:

_format_version: "3.0"
plugins:
  - name: kafka-upstream
    config:
      topic: ${{ env "DECK_KAFKA_TOPIC" }}
      bootstrap_servers:
      - host: localhost
        port: 9092
      topics_query_arg: topic-list
      allowed_topics:
      - my-topic
      - topic1
      - topic2
Copied to clipboard!

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!