Production-oriented Golang job queue API scaffold using Gin. Includes a Rust gRPC compute-engine example wired through the Go API.
make runPrerequisites:
- Go 1.22+
- Rust (stable toolchain) + Cargo
- Start Rust gRPC compute-engine (Terminal A):
cd compute-engine
cargo run- Start Go API and point to local Rust service (Terminal B):
PORT=8080 COMPUTE_ADDR=localhost:50051 go run ./cmd/api- Test endpoints (Terminal C):
curl -sS http://localhost:8080/healthz
curl -sS http://localhost:8080/
curl -sS -X POST http://localhost:8080/compute/square \
-H "Content-Type: application/json" \
-d '{"value":12}'If port 8080 is occupied, use another port like PORT=8081.
docker compose up --buildThis starts:
api(Go + Gin) on:8081(container internal port is8080)compute-engine(Rust + gRPC) on:50051postgreson:5432
make tidy
make test
make runmake run: start the API (default port8080)make test: run all testsmake build: build binary tobin/distributed-job-queue
- GET /healthz -> {"status":"ok"}
- GET / -> {"message":"distributed-job-queue api is running"}
- POST /compute/square -> forwards to Rust gRPC compute service
Example:
curl -sS -X POST http://localhost:8081/compute/square \
-H "Content-Type: application/json" \
-d '{"value":12}'Response:
{"engine":"rust-grpc","square":144,"value":12}- PORT (default: 8080)
- COMPUTE_ADDR (default: localhost:50051)