2021-07-13 17:14:25 +00:00
|
|
|
package worker
|
|
|
|
|
|
|
|
import (
|
2022-05-07 16:37:21 +00:00
|
|
|
"context"
|
2022-05-21 17:17:04 +00:00
|
|
|
"time"
|
2022-05-07 16:37:21 +00:00
|
|
|
|
2021-07-13 17:14:25 +00:00
|
|
|
"github.com/DataDog/datadog-go/statsd"
|
2022-11-01 23:02:25 +00:00
|
|
|
"github.com/adjust/rmq/v5"
|
2021-07-13 17:14:25 +00:00
|
|
|
"github.com/go-redis/redis/v8"
|
2023-03-24 17:12:09 +00:00
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
2022-11-05 19:59:33 +00:00
|
|
|
"go.opentelemetry.io/otel/trace"
|
2022-05-23 18:17:25 +00:00
|
|
|
"go.uber.org/zap"
|
2021-07-13 17:14:25 +00:00
|
|
|
)
|
|
|
|
|
2022-11-01 23:08:10 +00:00
|
|
|
const pollDuration = 100 * time.Millisecond
|
2022-05-21 17:17:04 +00:00
|
|
|
|
2022-11-05 19:59:33 +00:00
|
|
|
type NewWorkerFn func(context.Context, *zap.Logger, trace.Tracer, *statsd.Client, *pgxpool.Pool, *redis.Client, rmq.Connection, int) Worker
|
2021-07-13 17:14:25 +00:00
|
|
|
type Worker interface {
|
2021-07-14 00:09:44 +00:00
|
|
|
Start() error
|
2021-07-13 17:14:25 +00:00
|
|
|
Stop()
|
|
|
|
}
|