kafka-restconfluent-rest-proxy

Responding with custom response content in kafka rest proxy response payload


Is it possible to modify/customize response content? Suppose we have setup kafka rest proxy to receive data from external service and we don't want to reveal sensitive info like in which partition and offset data got stored. We just want to respond saying record processed/received (OR not processed).

Current success response(for 200)

  { "offsets": [{
                        "partition": 1,
                        "offset": 1,
                        "error_code": null,
                        "error": null
                }],
                "key_schema_id": null,
                "value_schema_id": null
   }

Can above response be customized or intercepted to something like below one?

     {"success": "Record received/processed successfully"}

Solution

  • You may set new endpoints (and responses) with kafka.rest.resource.extension.class property which requires writing your own REST extension java classes and putting them on the classpath of the proxy. However, without forking the project and modifying the source code, it's not possible to modify other responses