36 lines
987 B
Go
36 lines
987 B
Go
// 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)
|
|
}
|
|
} |