shreemaan-abhishek commented on issue #10416:
URL: https://github.com/apache/apisix/issues/10416#issuecomment-1786476525

   can you confirm if you changed the plugin-metadata using the 
[admin-api](https://apisix.apache.org/docs/apisix/admin-api/#plugin-metadata)? 
With the default plugin metadata it works for me.
   
   kafka setup:
   
   <details>
   <summary>Click me </summary>
   <br>
   
   Docker compose:
   
   ```yaml
   version: "3.8"
   
   services:
     zookeeper-server1:
       image: bitnami/zookeeper:3.6.0
       environment:
         ALLOW_ANONYMOUS_LOGIN: yes
       restart: unless-stopped
       ports:
         - "2181:2181"
       networks:
         kafka_net:
   
     zookeeper-server2:
       image: bitnami/zookeeper:3.6.0
       environment:
         ALLOW_ANONYMOUS_LOGIN: yes
       restart: unless-stopped
       ports:
         - "12181:12181"
       networks:
         kafka_net:
   
     kafka-server1:
       image: bitnami/kafka:2.8.1
       container_name: notkafka
       environment:
         KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper-server1:2181
         ALLOW_PLAINTEXT_LISTENER: yes
         KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: true
         KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
       restart: unless-stopped
       ports:
         - "9092:9092"
       depends_on:
         - zookeeper-server1
         - zookeeper-server2
       networks:
         kafka_net:
   
     kafka-server2:
       image: bitnami/kafka:2.8.1
       environment:
         KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper-server2:2181
         ALLOW_PLAINTEXT_LISTENER: yes
         KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: false
         KAFKA_CFG_LISTENERS: 
PLAINTEXT://0.0.0.0:19092,SASL_PLAINTEXT://0.0.0.0:19094
         KAFKA_CFG_ADVERTISED_LISTENERS: 
PLAINTEXT://127.0.0.1:19092,SASL_PLAINTEXT://127.0.0.1:19094
         KAFKA_CFG_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: 
         KAFKA_CFG_SSL_KEYSTORE_LOCATION: 
/opt/bitnami/kafka/config/certs/kafka.keystore.jks
         KAFKA_CFG_SSL_KEYSTORE_PASSWORD: changeit
         KAFKA_CFG_SSL_KEY_PASSWORD: changeit
   
       restart: unless-stopped
       ports:
         - "19092:19092"
         - "19094:19094"
       depends_on:
         - zookeeper-server1
         - zookeeper-server2
       networks:
         kafka_net:
   
   networks:
     kafka_net:
   ```
   
   route:
   
   ```shell
   curl "http://127.0.0.1:9180/apisix/admin/routes/1"; -X PUT \
     -H "X-API-KEY: ${ADMIN_API_KEY}" \
     -d '{
       "plugins": {
         "kafka-logger": {
           "brokers": [
             {
               "host": "127.0.0.1",
               "port": 9092
             }
           ],
           "kafka_topic": "test2",
           "key": "key1",
           "batch_max_size": 1,
           "name": "kafka logger",
           "include_req_body": true
         }
       },
       "upstream": {
         "nodes": {
           "httpbin.org:80": 1
         },
         "type": "roundrobin"
       },
       "uri": "/post"
     }'
   ```
   
   wait for logs from kafka:
   
   ```shell
   docker exec -it notkafka kafka-console-consumer.sh --bootstrap-server 
kafka-server1:9092 --topic test2 --from-beginning
   ```
   
   Send request:
   
   ```shell
   curl -i "http://127.0.0.1:9080/post"; -d '{"a": "b"}' -XPOST -H 
"content-type: application/json"
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to