Documentation ¶
Index ¶
- func GetChannelNameForApplication(baseChannelName string, applicationId string) string
- func GetResponseKeyForMessage(baseChannelName string, messageId string) string
- func NewConsumer(redisClient *redis.Client, baseChannelName string, ...) funcie.Consumer
- func NewConsumerWithClient(redisClient ConsumeClient, baseChannelName string, ...) funcie.Consumer
- func NewPublisher(redisClient PublishClient, baseChannelName string) funcie.Publisher
- type ConsumeClient
- type Consumer
- type PubSub
- type PublishClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetChannelNameForApplication ¶
GetChannelNameForApplication returns the Redis channel name for the given application ID.
func GetResponseKeyForMessage ¶
GetResponseKeyForMessage returns the Redis key for the response of a message
func NewConsumer ¶
func NewConsumer(redisClient *redis.Client, baseChannelName string, router utils.ClientHandlerRouter) funcie.Consumer
NewConsumer creates a new RedisConsumer that consumes messages from channels starting with the given base name. This implementation takes in a *redis.Client instead of a RedisConsumeClient so that it can be used with a real Redis client.
func NewConsumerWithClient ¶
func NewConsumerWithClient(redisClient ConsumeClient, baseChannelName string, router utils.ClientHandlerRouter) funcie.Consumer
NewConsumerWithClient creates a new RedisConsumer that consumes messages from channels starting with the given base name.
func NewPublisher ¶
func NewPublisher(redisClient PublishClient, baseChannelName string) funcie.Publisher
NewPublisher creates a new RedisPublisher that publishes messages to the given channel.
Types ¶
type ConsumeClient ¶
type ConsumeClient interface { Subscribe(ctx context.Context, channels ...string) PubSub RPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd Publish(ctx context.Context, channel string, message interface{}) *redis.IntCmd }
ConsumeClient is the interface that wraps the redis client methods used by the consumer.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents a consumer that consumes messages from a Redis channel.
type PubSub ¶
type PubSub interface { Channel(opts ...redis.ChannelOption) <-chan *redis.Message Subscribe(ctx context.Context, channels ...string) error Unsubscribe(ctx context.Context, channels ...string) error Receive(ctx context.Context) (interface{}, error) Close() error }
PubSub is the interface that wraps the redis PubSub methods used by the consumer.