mirror of
https://github.com/hibiken/asynq.git
synced 2025-10-22 22:06:12 +08:00
feat: allow custom broker
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
||||
"github.com/hibiken/asynq/internal/errors"
|
||||
pb "github.com/hibiken/asynq/internal/proto"
|
||||
"github.com/hibiken/asynq/internal/timeutil"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
@@ -718,8 +717,14 @@ type Broker interface {
|
||||
ClearServerState(host string, pid int, serverID string) error
|
||||
|
||||
// Cancelation related methods
|
||||
CancelationPubSub() (*redis.PubSub, error) // TODO: Need to decouple from redis to support other brokers
|
||||
SubscribeCancellation() (CancellationSubscription, error)
|
||||
PublishCancelation(id string) error
|
||||
|
||||
WriteResult(qname, id string, data []byte) (n int, err error)
|
||||
}
|
||||
|
||||
// CancellationSubscription is a subscription to cancellation messages.
|
||||
type CancellationSubscription interface {
|
||||
Channel() <-chan string // returns a channel to receive the id of tasks to be cancelled.
|
||||
Close() error // closes the subscription.
|
||||
}
|
||||
|
Reference in New Issue
Block a user