Documentation
¶
Index ¶
- Constants
- Variables
- func GetScore(message *message.Message) (float64, error)
- func NewMessage(uuid string, score float64, payload message.Payload) *message.Message
- type BaseClient
- type BlockMode
- type Client
- type Client2_0
- type Client5_0
- type ConsumeRange
- type DefaultMarshallerUnmarshaller
- type Locker
- type Marshaller
- type MarshallerUnmarshaller
- type Publisher
- type PublisherConfig
- type StrictSubscriber
- type StrictSubscriberConfig
- type Subscriber
- type SubscriberConfig
- type Unmarshaller
- type WithoutScoreMarshallerUnmarshaller
- type WithoutTraceMarshallerUnmarshaller
Constants ¶
View Source
const ( // NoSleep can be set to SubscriberConfig.NackResendSleep NoSleep time.Duration = -1 DefaultBlockTime = time.Second DefaultRestTime = time.Millisecond * 100 )
View Source
const UUIDHeaderKey = "_watermill_message_uuid"
Variables ¶
View Source
var DefaultConsumeRange = func(topic string) (min, max string, err error) { return "-inf", "+inf", nil }
Functions ¶
Types ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
func (BaseClient) Close ¶
func (b BaseClient) Close() error
type Client ¶
type Client interface {
ZRem(ctx context.Context, key string, members ...interface{}) (int64, error)
ZAdd(ctx context.Context, key string, members ...redis.Z) (int64, error)
ZPopMin(ctx context.Context, key string, count ...int64) ([]redis.Z, error)
BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) (*redis.ZWithKey, error)
Close() error
}
type ConsumeRange ¶ added in v0.0.3
type DefaultMarshallerUnmarshaller ¶
type DefaultMarshallerUnmarshaller struct{}
type Marshaller ¶
type MarshallerUnmarshaller ¶
type MarshallerUnmarshaller interface {
Marshaller
Unmarshaller
}
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
func NewPublisher ¶
func NewPublisher(config PublisherConfig, logger watermill.LoggerAdapter) (*Publisher, error)
NewPublisher creates a new redis stream Publisher.
type PublisherConfig ¶
type PublisherConfig struct {
Client redis.UniversalClient
Marshaller Marshaller
}
func (*PublisherConfig) Validate ¶
func (c *PublisherConfig) Validate() error
type StrictSubscriber ¶
type StrictSubscriber struct {
// contains filtered or unexported fields
}
func NewStrictSubscriber ¶
func NewStrictSubscriber(config StrictSubscriberConfig, locker Locker, logger watermill.LoggerAdapter) (*StrictSubscriber, error)
NewStrictSubscriber creates a new redis zset Subscriber.
func (*StrictSubscriber) Close ¶
func (s *StrictSubscriber) Close() error
type StrictSubscriberConfig ¶
type StrictSubscriberConfig struct {
Client redis.UniversalClient
Unmarshaller Unmarshaller
// How long should we rest after got nothing
RestTime time.Duration
// After a failed consumption, the strictMessageHandler will receive a nack, and it is better to wait for some time before retrying.
NackResendSleep time.Duration
ConsumeRange ConsumeRange
}
func (*StrictSubscriberConfig) Validate ¶
func (sc *StrictSubscriberConfig) Validate() error
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func NewSubscriber ¶
func NewSubscriber(config SubscriberConfig, logger watermill.LoggerAdapter) (*Subscriber, error)
NewSubscriber creates a new redis zset Subscriber.
func (*Subscriber) Close ¶
func (s *Subscriber) Close() error
type SubscriberConfig ¶
type SubscriberConfig struct {
Client redis.UniversalClient
Unmarshaller Unmarshaller
// Block if there are no members to pop from sorted set if BlockMode is Block
BlockMode BlockMode
// Block to wait next redis zset message, only works while BlockMode is Block
BlockTime time.Duration
// How long should we rest after got nothing, only works while BlockMode is NotBlock
RestTime time.Duration
// After a failed consumption, the messageHandler will receive a nack, and it is better to wait for some time before retrying.
NackResendSleep time.Duration
}
func (*SubscriberConfig) Validate ¶
func (sc *SubscriberConfig) Validate() error
type Unmarshaller ¶
type WithoutScoreMarshallerUnmarshaller ¶
type WithoutScoreMarshallerUnmarshaller struct{}
type WithoutTraceMarshallerUnmarshaller ¶
type WithoutTraceMarshallerUnmarshaller struct{}
Click to show internal directories.
Click to hide internal directories.