liveBook · Manning

REST

As explained in Apache Kafka in Action

REST is an architectural style for networked applications that represents resources and accesses them through stateless, uniform interfaces.

A storefront might use an HTTP-REST API when its frontend asks a backend for customer information. The same API can also serve communication between backends. REST is resource-oriented: a service makes a request when it needs data, and another service responds. This makes it easy to start with, but a request can depend on the responding service being available. section 17.3 section 17.3.2 section 17.6

Kafka Connect provides a practical REST API for a different job: administering connectors that move data between Kafka and external systems. Start a Connect worker, whose API listens on port 8083 by default, then send connector configurations as JSON. The API manages the connector; the connector performs the data transfer. section 11.2.1 section 11.10

$ curl -X POST -H "Content-Type: application/json" \
    --data @source-connector.json \
    http://localhost:8083/connectors

This POST sends source-connector.json to /connectors. In the customer-file example, that JSON names a FileStreamSource connector, its input file, and the Kafka topic that receives the records. section 11.2.2

After creation, the connector remains manageable through HTTP requests:

  • Use PUT /connectors/<connector>/config to change its configuration, such as the source-file path. section 11.5.2
  • Pause a connector during maintenance, check its status, and resume it afterward. section 11.5.2
  • Delete an unneeded connector or, after fixing a persistent problem, restart failed tasks. section 11.5.2

Do not confuse this management API with the choice of how services exchange business data. REST-based synchronous calls transmit data when requested. Kafka instead distributes events as they occur, which can reduce service coupling and support high-throughput flows, but requires additional infrastructure and operational expertise. Choose based on the communication need rather than replacing every useful request with an event. section 17.3.2 section 17.6

How Apache Kafka in Action covers it

How deep it goes
Explains resource-oriented requests and works through connector operations, but does not develop REST's architectural constraints.
Examples
Demonstrates curl requests that create a customer-file connector, change its source path, and pause or restart it.
What it assumes
Assumes basic HTTP and JSON familiarity while showing worker startup and a concrete connector configuration.
What you can do after
Operate/configure it through Kafka Connect's REST API to create, update, inspect, pause, resume, delete, and restart connectors.
How it connects
Connects REST to synchronous microservice communication, Kafka event streaming, and Kafka Connect administration.

Also explained in

Compare how 22 books explain REST →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.