Documentation
¶
Index ¶
Constants ¶
View Source
const (
DefaultChannelSize = 100
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EmptySubscription ¶
type EmptySubscription[MessageType any] struct{}
func (EmptySubscription[MessageType]) Channel ¶
func (s EmptySubscription[MessageType]) Channel() <-chan MessageType
func (EmptySubscription[MessageType]) Close ¶
func (s EmptySubscription[MessageType]) Close() error
type MessageBus ¶
type MessageBus interface {
Publish(ctx context.Context, channel string, msg proto.Message) error
Subscribe(ctx context.Context, channel string, channelSize int) (Reader, error)
SubscribeQueue(ctx context.Context, channel string, channelSize int) (Reader, error)
}
func NewLocalMessageBus ¶
func NewLocalMessageBus() MessageBus
func NewNatsMessageBus ¶
func NewNatsMessageBus(nc *nats.Conn) MessageBus
func NewRedisMessageBus ¶
func NewRedisMessageBus(rc redis.UniversalClient) MessageBus
type Subscription ¶
type Subscription[MessageType proto.Message] interface { Channel() <-chan MessageType Close() error }
func Subscribe ¶
func Subscribe[MessageType proto.Message]( ctx context.Context, bus MessageBus, channel string, channelSize int, ) (Subscription[MessageType], error)
func SubscribeQueue ¶
func SubscribeQueue[MessageType proto.Message]( ctx context.Context, bus MessageBus, channel string, channelSize int, ) (Subscription[MessageType], error)
Click to show internal directories.
Click to hide internal directories.