Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultMaxLen int64 = 10000
DefaultMaxLen 单流默认近似上限条数(Publish 时 MAXLEN ~)。
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus 基于 Backend 的 Redis Stream 风格事件总线(每 group 独立消费)。
func New ¶
New 创建总线。prefix 用于 stream key:{prefix}:{topic};空则用 "event"。 默认 WithMaxLen(DefaultMaxLen);可用 Option 覆盖。
func (*Bus) Consumer ¶
func (b *Bus) Consumer(group, consumer string, opts ...ConsumerOption) *Consumer
Consumer 创建链式消费者。默认 handler 池 min=2 max=8(Run 时创建)。
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer 预注册多 topic 消费者:链式 On,Run 单循环多 Stream BLOCK 读。
type ConsumerOption ¶
type ConsumerOption func(*Consumer)
ConsumerOption 配置 Consumer 的 handler 池等。
func WithHandlerPool ¶
func WithHandlerPool(p *gopool.Pool) ConsumerOption
WithHandlerPool 使用外部工人池(生命周期由该池的 New ctx 管理)。
func WithHandlerWorkers ¶
func WithHandlerWorkers(minSize, maxSize int) ConsumerOption
WithHandlerWorkers 使用内建动态池 min~max(在 Run 时用其 ctx 创建)。
Click to show internal directories.
Click to hide internal directories.