backbeat: add module sources
This commit is contained in:
36
cmd/sdk-examples/main.go
Normal file
36
cmd/sdk-examples/main.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user