mirror of
https://github.com/kwinH/fastApi.git
synced 2025-12-24 13:07:58 +08:00
29 lines
420 B
Go
29 lines
420 B
Go
package asynq
|
|
|
|
import (
|
|
"context"
|
|
"fastApi/core/logger"
|
|
"github.com/hibiken/asynq"
|
|
)
|
|
|
|
func init() {
|
|
MQList = append(MQList, NewTest())
|
|
}
|
|
|
|
type Test struct {
|
|
BaseMQ
|
|
}
|
|
|
|
func NewTest() *Test {
|
|
return &Test{
|
|
BaseMQ: BaseMQ{
|
|
Typename: "test",
|
|
}}
|
|
}
|
|
|
|
func (c *Test) Consumer(ctx context.Context, t *asynq.Task) error {
|
|
logger.SLog(ctx).Infof("type: %v, payload: %s", t.Type(), string(t.Payload()))
|
|
|
|
return nil
|
|
}
|