The Kafka Rest Proxy is an addon which can be added when creating an Instaclustr Managed Apache Kafka Cluster. Note that enabling this add-on will add 20% to standard costs. If you would like to add the Kafka Rest Proxy to an existing cluster, you should contact support to have it added.
To create a new Kafka cluster with the Kafka REST Proxy add-on, make sure to enable Kafka REST Proxy under the Enterprise Add-Ons subsection on the Kafka setup page.
You can also choose to integrate the Kafka REST Proxy with a Kafka Schema Registry of your choice. To do so, simply click the checkbox and enter the server details for the Kafka Schema Registry. Alternatively, you can create a local Kafka Schema Registry on the cluster and choose to integrate the Kafka REST Proxy with the local one.
Configuring the Kafka Rest Proxy
To start using the Kafka Rest Proxy, you must first open the firewall to your client application IP address. Once your cluster is up and running, go to Firewall Rules and add your IP address to the Kafka REST Proxy Allowed Addresses.
Connecting to the Kafka Rest Proxy
The Kafka Rest Proxy is hosted in our Instaclustr hosted zone, cnodes.io. You can access the Kafka Rest Proxy by using the subdomain we have created.
Connection information can be retrieved on the Connection Info page for the cluster running the Kafka REST Proxy.
This page also includes the username and automatically generated password, plus code samples for testing connectivity to your Kafka REST Proxy servers.
Important information regarding Kafka Rest Proxy access
We currently do not offer the ability to restrict access via ACLs for Kafka Rest Proxy clients, the Kafka Rest Proxy service connects to your Apache Kafka cluster and has access to all topics stored in the cluster.
Please make sure you understand this restriction before adding the Kafka Rest Proxy service to your cluster.
Using the Kafka Rest Proxy
The Kafka Rest Proxy operates as a RESTful web API, any application that can send and receive HTTPS messages can be configured to operate with the application.
Special attention should be paid to the Content Type headers sent with each request. The same Content Type headers must be sent when setting up and configuring consumer instances and producing Kafka topics, otherwise, the requests may fail or return 404 NOT FOUND.
For more information about what content types are supported, refer to the following documentation:
The most common issue for new users is you receive a 404 NOT FOUND when attempting to consume from your consumer instance.
There can be a few reasons this may occur
Mismatched “Content-Type” headers
Check your Content-Type headers are consistent for each request made to create and configure your consumer instance, any mismatch on datatype or API version will cause requests to fail.
The consumer instance exists on another Kafka Rest Proxy server
Ensure you are communicating with the correct server. Instaclustr offers 3 Kafka Rest Proxy nodes to produce and consume from, however, a single consumer instance only exists on the server it was created.
To use this consumer instance, you must keep connecting to the same server by its IP address. To facilitate this pattern, in addition to the ID of the consumer instance, the Kafka Rest Proxy will also return the fully qualified URL your application should use.
Idle consumer instances are deleted after 5 minutes
The final reason could be the consumer instance has been deleted, either because it was idle for longer than 5 minutes or the Kafka Rest Proxy application was restarted.
The Kafka Rest Proxy application was restarted
While Instaclustr does everything it can to avoid restarting your applications, they may get restarted during general maintenance or troubleshooting operations.
To account for both scenarios, you can ensure your client code is robust by attempting to use the existing consumer instance, and if you receive a 404 response, creating a new consumer instance and using that one.
The example above is a simple illustration of a basic produce/consume workflow.
Instaclustr supports provides and supports all the available features and operations provided by the Kafka Rest Proxy.
Please consult the API reference for a comprehensive guide to these features.
The Kafka Rest Proxy enables you to integrate an Instaclustr Managed Kafka cluster with any system that can communicate with a simple HTTPS RESTful API.
Due to the change in licensing agreement, Instaclustr has forked the original Kafka-Rest solution and will maintain updates at this GitHub repository.