Added task worker service and example task processor.

This commit is contained in:
mikestefanello 2022-02-08 08:58:22 -05:00
parent 27a2389e2c
commit 90408d68a7
6 changed files with 105 additions and 13 deletions

22
worker/tasks/example.go Normal file
View file

@ -0,0 +1,22 @@
package tasks
import (
"context"
"log"
"github.com/hibiken/asynq"
)
// TypeExample is the type for the example task.
// This is what is passed in to TaskClient.New() when creating a new task
const TypeExample = "example_task"
// ExampleProcessor processes example tasks
type ExampleProcessor struct {
}
// ProcessTask handles the processing of the task
func (p *ExampleProcessor) ProcessTask(ctx context.Context, t *asynq.Task) error {
log.Printf("executing task: %s", t.Type())
return nil
}