backbeat: add module sources

This commit is contained in:
anthonyrawlins
2025-10-17 08:56:25 +11:00
parent 627d15b3f7
commit 4b4eb16efb
48 changed files with 11636 additions and 0 deletions

36
cmd/sdk-examples/main.go Normal file
View File

@@ -0,0 +1,36 @@
// Command sdk-examples provides executable examples of BACKBEAT SDK usage
package main
import (
"flag"
"fmt"
"os"
"github.com/chorus-services/backbeat/pkg/sdk/examples"
)
func main() {
var exampleName string
flag.StringVar(&exampleName, "example", "simple", "Example to run: simple, task-processor, service-monitor")
flag.Parse()
fmt.Printf("Running BACKBEAT SDK example: %s\n", exampleName)
fmt.Println("Press Ctrl+C to stop")
fmt.Println()
switch exampleName {
case "simple":
examples.SimpleAgent()
case "task-processor":
examples.TaskProcessor()
case "service-monitor":
examples.ServiceMonitor()
default:
fmt.Printf("Unknown example: %s\n", exampleName)
fmt.Println("Available examples:")
fmt.Println(" simple - Basic beat subscription and status emission")
fmt.Println(" task-processor - Beat budget usage for task timeout management")
fmt.Println(" service-monitor - Health monitoring with beat-aligned reporting")
os.Exit(1)
}
}