Skip to content

sudojarvis/api-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

THINGS ADDED TO SCALE UP:

ADD MULTIPLE BROKERS TO THE CLUSTER

Kafka Task API

This is a simple HTTP server built with Go and Fiber that interacts with Apache Kafka to add and retrieve tasks.

Requirements

  • Go
  • Fiber
  • Sarama

Installation

  1. Install Go: https://golang.org/doc/install
  2. Install Fiber: go get -u github.com/gofiber/fiber/v2
  3. Install Sarama: go get -u github.com/IBM/sarama

Usage

  1. Start a Kafka broker on localhost:9092.
  2. Run the server: go run main.go.
  3. Use a POST request to add a task: curl -X POST -d '{"id": 1}' http://localhost:3000/task.
  4. Use a GET request to retrieve a task: curl http://localhost:3000/task.

Configuration

  • Kafka broker address: Modify the broker variable in main.go to point to your Kafka broker.

API Endpoints

Add Task

  • URL: /task
  • Method: POST
  • Request Body:
    {
      "id": 1
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages