This project is a Java-based implementation of a Kafka broker, designed as part of the Codecrafters Kafka Challenge. The goal is to create a functional Kafka broker that can handle client connections, process requests, and manage data distribution across a cluster.
- Implemented a basic server that listens on port 9092.
- Accepts client connections and handles requests in separate threads.
- Implemented the response body for the
APIVersions(v4) request. - Validates the message length and correlation ID in the response.
- Ensures the error code in the response body is
0(No Error). - Includes at least one entry for the API key
18(API_VERSIONS) with aMaxVersionof at least 4.
- Modified the server to handle multiple sequential requests from the same client.
- Ensures that the server continues to listen for and process additional requests from the same connection.
- Added support for handling concurrent requests from multiple clients.
- Uses threads to handle each client connection independently, allowing the server to process requests from multiple clients concurrently.
To run the server, execute the following command:
$ ./your_program.shThe server will start listening on port 9092 and will be ready to accept client connections.
The server has been tested to handle APIVersions (v4) requests from multiple clients. Each response is validated to ensure:
- The first 4 bytes of the response (the "message length") are valid.
- The correlation ID in the response header matches the correlation ID in the request header.
- The error code in the response body is
0(No Error). - The response body contains at least one entry for the API key
18(API_VERSIONS) with aMaxVersionof at least4.