brokers

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSparseGoroutine

func NewSparseGoroutine[I, T comparable](queueFactory func(index int) nexus.Queue[I, T], handler SparseGoroutineMessageHandler) nexus.Broker[I, T]

Types

type SparseGoroutine

type SparseGoroutine[I, T comparable] struct {
	// contains filtered or unexported fields
}

func (*SparseGoroutine[I, T]) Close

func (s *SparseGoroutine[I, T]) Close()

func (*SparseGoroutine[I, T]) Publish

func (s *SparseGoroutine[I, T]) Publish(topic T, event nexus.Event[I, T]) error

Publish 将消息分发到特定 topic,当 topic 首次使用时,将会根据负载均衡策略选择一个队列

  • 设置 count 会增加消息的外部计数,当 SparseGoroutine 关闭时会等待外部计数归零

func (*SparseGoroutine[I, T]) Run

func (s *SparseGoroutine[I, T]) Run()

Run 启动 Reactor,运行队列

type SparseGoroutineMessageHandler

type SparseGoroutineMessageHandler func(handler nexus.EventExecutor)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL