Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrClosed = errors.New("pubsub: subscriber is closed")
)
var WireSet = wire.NewSet( ProvidePubSub, )
Functions ¶
This section is empty.
Types ¶
type InMemory ¶
type InMemory struct {
// contains filtered or unexported fields
}
func NewInMemory ¶
NewInMemory create an instance of memory pubsub implementation.
type Option ¶
type Option interface {
Apply(*Config)
}
An Option configures a pubsub instance.
func WithHealthCheckInterval ¶
WithHealthCheckInterval specifies the config health check interval. PubSub will ping Server if it does not receive any messages within the interval (redis, ...). To disable health check, use zero interval.
func WithNamespace ¶
WithNamespace returns an option that set config namespace.
func WithSendTimeout ¶
WithSendTimeout specifies the pubsub send timeout after which the message is dropped.
type OptionFunc ¶
type OptionFunc func(*Config)
OptionFunc is a function that configures a pubsub config.
type PubSub ¶
type PubSub interface { Publisher // Subscribe consumer to process the topic with payload, this should be // blocking operation. Subscribe(ctx context.Context, topic string, handler func(payload []byte) error, options ...SubscribeOption) Consumer }
func ProvidePubSub ¶
type PublishConfig ¶
type PublishConfig struct {
// contains filtered or unexported fields
}
type PublishOption ¶
type PublishOption interface {
Apply(*PublishConfig)
}
func WithPublishApp ¶
func WithPublishApp(value string) PublishOption
WithPublishApp modifies publish config app identifier.
func WithPublishNamespace ¶
func WithPublishNamespace(value string) PublishOption
WithPublishNamespace modifies publish config namespace.
type PublishOptionFunc ¶
type PublishOptionFunc func(*PublishConfig)
PublishOptionFunc is a function that configures a publish config.
func (PublishOptionFunc) Apply ¶
func (f PublishOptionFunc) Apply(config *PublishConfig)
Apply calls f(publishConfig).
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
type SubscribeConfig ¶
type SubscribeConfig struct {
// contains filtered or unexported fields
}
type SubscribeOption ¶
type SubscribeOption interface {
Apply(*SubscribeConfig)
}
SubscribeOption configures a subscription config.
func WithChannelHealthCheckInterval ¶
func WithChannelHealthCheckInterval(value time.Duration) SubscribeOption
WithChannelHealthCheckInterval specifies the channel health check interval. PubSub will ping Server if it does not receive any messages within the interval. To disable health check, use zero interval.
func WithChannelNamespace ¶
func WithChannelNamespace(value string) SubscribeOption
WithNamespace returns an channel option that configures namespace.
func WithChannelSendTimeout ¶
func WithChannelSendTimeout(value time.Duration) SubscribeOption
WithChannelSendTimeout specifies the channel send timeout after which the message is dropped.
func WithChannelSize ¶
func WithChannelSize(value int) SubscribeOption
WithChannelSize specifies the Go chan size that is used to buffer incoming messages for subscriber.
func WithTopics ¶
func WithTopics(topics ...string) SubscribeOption
WithTopics specifies the topics to subsribe.
type SubscribeOptionFunc ¶
type SubscribeOptionFunc func(*SubscribeConfig)
SubscribeOptionFunc is a function that configures a subscription config.
func (SubscribeOptionFunc) Apply ¶
func (f SubscribeOptionFunc) Apply(config *SubscribeConfig)
Apply calls f(subscribeConfig).