Skip to content

aartinian/go-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-router

A lightweight Go microservice that routes tasks to workers while maintaining session affinity.

Features

  • Session Affinity: Tasks from the same session always go to the same worker
  • Load Balancing: Worker selection based on capacity and load
  • Auto Retry: Failed messages automatically retry with configurable delays
  • Health Checks: Built-in health endpoints for monitoring

Quick Start

Requirements

  • Go 1.23+
  • RabbitMQ
  • Redis
  • Docker (optional)

Installation

# Clone the repository
git clone https://github.com/aartinian/go-router.git
cd go-router

# Download dependencies
go mod download

# Build
go build -o router ./cmd/router

Configuration

Copy the example environment file and configure:

cp env.example .env
# Edit .env with your RabbitMQ and Redis settings

Run

# Start the router
./router

# Or with Docker
docker build -t go-router .
docker run --env-file .env go-router

Health Check

curl http://localhost:8080/healthz

Message Format

Send JSON messages to your configured queue:

{
  "session_id": "user-123",
  "payload": "your task data"
}

License

MIT License - see LICENSE file for details.

About

A Go microservice that routes tasks to workers while maintaining session affinity with retry mechanisms

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published