bus

package
v1.11.25 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubscribeBuffer  = 1
	SubscriptionName = "events"
)

Variables

This section is empty.

Functions

func NewNATSConnection

func NewNATSConnection(uri string) (*nats.EncodedConn, error)

Types

type Bus

type Bus interface {
	Publish(event testkube.Event) error
	Subscribe(queue string, handler Handler) error
	Unsubscribe(queue string) error

	PublishTopic(topic string, event testkube.Event) error
	SubscribeTopic(topic string, queue string, handler Handler) error

	Close() error
}

type EventBusMock added in v1.5.33

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

func NewEventBusMock added in v1.5.33

func NewEventBusMock() *EventBusMock

func (*EventBusMock) Close added in v1.5.33

func (b *EventBusMock) Close() error

func (*EventBusMock) ListQueues added in v1.10.47

func (b *EventBusMock) ListQueues() []string

func (*EventBusMock) Publish added in v1.5.33

func (b *EventBusMock) Publish(event testkube.Event) error

func (*EventBusMock) PublishTopic added in v1.10.21

func (b *EventBusMock) PublishTopic(topic string, event testkube.Event) error

func (*EventBusMock) Subscribe added in v1.5.33

func (b *EventBusMock) Subscribe(queue string, handler Handler) error

func (*EventBusMock) SubscribeTopic added in v1.10.21

func (b *EventBusMock) SubscribeTopic(topic, queue string, handler Handler) error

func (*EventBusMock) Unsubscribe added in v1.5.33

func (b *EventBusMock) Unsubscribe(queue string) error

type Handler

type Handler func(event testkube.Event) error

type NATSBus

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

func NewNATSBus

func NewNATSBus(nc *nats.EncodedConn) *NATSBus

func (*NATSBus) Close

func (n *NATSBus) Close() error

func (*NATSBus) Publish

func (n *NATSBus) Publish(event testkube.Event) error

Publish publishes event to NATS on events topic

func (*NATSBus) PublishTopic added in v1.10.21

func (n *NATSBus) PublishTopic(topic string, event testkube.Event) error

PublishTopic publishes event to NATS on given topic

func (*NATSBus) Subscribe

func (n *NATSBus) Subscribe(queueName string, handler Handler) error

Subscribe subscribes to NATS events topic

func (*NATSBus) SubscribeTopic added in v1.10.21

func (n *NATSBus) SubscribeTopic(topic, queueName string, handler Handler) error

SubscribeTopic subscribes to NATS topic

func (*NATSBus) Unsubscribe

func (n *NATSBus) Unsubscribe(queueName string) error

Jump to

Keyboard shortcuts

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