diff --git a/broker/broker.go b/broker/broker.go new file mode 100644 index 0000000..32d9ed3 --- /dev/null +++ b/broker/broker.go @@ -0,0 +1,25 @@ +package broker + +import ( + "github.com/hibiken/asynq/internal/base" + "github.com/hibiken/asynq/internal/rdb" +) + +// This package exports the same types as the internal package. +// This is a temporary solution until we can move the these types out of internal. + +type ( + TaskMessage = base.TaskMessage + WorkerInfo = base.WorkerInfo + ServerInfo = base.ServerInfo + + Broker = base.Broker + + CancellationSubscription = base.CancellationSubscription + + RDB = rdb.RDB +) + +var ( + NewRDB = rdb.NewRDB +) diff --git a/client.go b/client.go index beb5020..fcf776e 100644 --- a/client.go +++ b/client.go @@ -11,6 +11,7 @@ import ( "time" "github.com/google/uuid" + "github.com/hibiken/asynq/broker" "github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/rdb" @@ -49,7 +50,7 @@ func NewClientFromRedisClient(c redis.UniversalClient) *Client { // NewClientFromBroker returns a new instance of Client given a broker. // Warning: The underlying broker will not be closed by Asynq, you are responsible for closing it. -func NewClientFromBroker(b base.Broker) *Client { +func NewClientFromBroker(b broker.Broker) *Client { return &Client{broker: b, sharedConnection: true} } diff --git a/server.go b/server.go index a5019d8..ea3ae50 100644 --- a/server.go +++ b/server.go @@ -15,6 +15,7 @@ import ( "sync" "time" + "github.com/hibiken/asynq/broker" "github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/log" "github.com/hibiken/asynq/internal/rdb" @@ -449,7 +450,7 @@ func NewServerFromRedisClient(c redis.UniversalClient, cfg Config) *Server { // NewServerFromBroker returns a new instance of Server given a Broker and server configuration. // Warning: The underlying broker will not be closed by Asynq, you are responsible for closing it. -func NewServerFromBroker(b base.Broker, cfg Config) *Server { +func NewServerFromBroker(b broker.Broker, cfg Config) *Server { baseCtxFn := cfg.BaseContext if baseCtxFn == nil { baseCtxFn = context.Background