dispatcher

package
v0.0.0-...-d2aac13 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPublishTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDispatcher

type EventDispatcher interface {
	Publish(topic string, data []byte) error
	Subscribe(cName string, topic string, handler MsgHandler) error
}

func NewInMemoryBus

func NewInMemoryBus() EventDispatcher

type InMemoryEventDispatcher

type InMemoryEventDispatcher struct{}

func (*InMemoryEventDispatcher) Publish

func (d *InMemoryEventDispatcher) Publish(topic string, data []byte) error

func (*InMemoryEventDispatcher) Subscribe

func (d *InMemoryEventDispatcher) Subscribe(cName string, topic string, handler MsgHandler) error

type MsgHandler

type MsgHandler func(data []byte) error

type NatsDispatcher

type NatsDispatcher struct {
	// contains filtered or unexported fields
}

func NewNatsDispatcher

func NewNatsDispatcher(opts ...NatsDispatcherOptsFunc) *NatsDispatcher

func (*NatsDispatcher) Publish

func (nd *NatsDispatcher) Publish(topic string, data []byte) error

func (*NatsDispatcher) Subscribe

func (nd *NatsDispatcher) Subscribe(cName string, topic string, handler MsgHandler) error

type NatsDispatcherOpts

type NatsDispatcherOpts struct {
	// contains filtered or unexported fields
}

type NatsDispatcherOptsFunc

type NatsDispatcherOptsFunc func(*NatsDispatcherOpts)

func WithBucket

func WithBucket(b string) NatsDispatcherOptsFunc

func WithToken

func WithToken(b string) NatsDispatcherOptsFunc

func WithUrl

func WithUrl(u string) NatsDispatcherOptsFunc

type RabbitMQDispatcher

type RabbitMQDispatcher struct {
	// contains filtered or unexported fields
}

func NewRabbitMQDispatcher

func NewRabbitMQDispatcher(server string, exchange string) *RabbitMQDispatcher

func (*RabbitMQDispatcher) Close

func (rd *RabbitMQDispatcher) Close()

func (*RabbitMQDispatcher) Publish

func (rd *RabbitMQDispatcher) Publish(topic string, data []byte) error

func (*RabbitMQDispatcher) Subscribe

func (rd *RabbitMQDispatcher) Subscribe(cName string, topic string, handler MsgHandler) error

Jump to

Keyboard shortcuts

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