32 lines
694 B
Go
32 lines
694 B
Go
package jobdef
|
|
|
|
import "context"
|
|
|
|
type SampleHandler struct{}
|
|
|
|
func (SampleHandler) Key() string {
|
|
return "sample-handler"
|
|
}
|
|
|
|
func (SampleHandler) Name() string {
|
|
return "Sample Handler"
|
|
}
|
|
|
|
func (SampleHandler) Description() string {
|
|
return "Writes a sample startup log for scheduler plumbing."
|
|
}
|
|
|
|
func (SampleHandler) Run(ctx context.Context, runtime Runtime, req ExecuteRequest) error {
|
|
req.LogCollector.Appendf("sample handler executed: jobID=%s executionID=%s triggerType=%s", req.JobID, req.ExecutionID, req.TriggerType)
|
|
runtime.Logger.Info(
|
|
"sample handler executed",
|
|
"jobID",
|
|
req.JobID,
|
|
"executionID",
|
|
req.ExecutionID,
|
|
"triggerType",
|
|
req.TriggerType,
|
|
)
|
|
return nil
|
|
}
|