For this tutorial, we will walk through the basics of using API Exploration to subscribe and publish to a Kafka API.
Requirements
To complete this tutorial, you need:
-
Access to API Exploration (click here if you need help with that).
-
Basic knowledge of Kafka APIs.
-
Access to a Kafka installation.
Trying out a Kafka API
You will need to use your own Kafka site for this tutorial, so you will need to adjust the settings appropriately in the following examples.
Subscribing to an event stream
Let's subscribe to an event feed from Kafka. to do that:
- Set the Protocol to Kafka
- Set the Operation to Subscribe
- Paste/enter your server address and channel into the Server and Channel fields.
- Click on Authorization Settings to specify your login credentials
- Click on Connection Settings & Properties to specify how long you want the subscription to last
Your screen will look like this:
Finally, click on the Subscribe button to begin your subscription. As events happen, you will see records appear in the Received Data section at the bottom of the window, like this:
You can click on individual event messages to see more detail:
The event stream will end per your settings in Connection Settings & Parameters -- by default after no longer than 60 seconds.
Publishing
To publish with Kafka:
- Set the Operation to Publish
- Click on Body and paste the data
Click Publish to complete the publish operation.