Help us shape the future of Go! Take the 2026 Go Developer Survey

echo-handler

command
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 13 Imported by: 0

README

QueueForge — Echo Handler Example

This example demonstrates how to implement a native Go worker using the QueueForge worker runtime.

Features Demonstrated

  1. Worker instantiation (worker.NewWorker(...))
  2. Handler registration (w.RegisterHandler("echo", handlerFunc))
  3. Permanent error classification (domain.Permanent(...)) for non-retryable errors
  4. Context deadline and cooperative cancellation observance (ctx.Done())
  5. Clean JSON result marshaling
  6. Graceful shutdown on SIGINT/SIGTERM

Running the Example

# Make sure QF_DATABASE_URL points to your running PostgreSQL instance
export QF_DATABASE_URL="postgres://postgres:postgres@localhost:5435/queueforge?sslmode=disable"

go run ./examples/echo-handler/main.go

Submitting an Echo Job via API

curl -X POST http://localhost:8080/v1/jobs \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "task_type": "echo",
    "queue": "default",
    "payload": {
      "message": "Hello from QueueForge Echo Worker!",
      "sleep_ms": 100
    }
  }'

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL