broker

package
v0.0.0-...-730ab85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Options() *Options
	NewProducer() (Producer, error)
	NewConsumer(opts ...SubscribeOption) (Consumer, error)
	Close() error
	Type() string
}

type Consumer

type Consumer interface {
	GroupID() string
	Topic() string
	Subscribe(topic string, h Handler) error
	Unsubscribe() error
}

type Event

type Event interface {
	Topic() string
	Message() *Message
	Error() error
	Ack() error
}

type Handler

type Handler func(Event) error

type Message

type Message struct {
	Header map[string]interface{}
	Body   []byte
}

type Option

type Option func(*Options)

type Options

type Options struct {
	Addr         []string
	Kafka        *sarama.Config
	RabbitMq     *RabbitMq
	ErrorHandler Handler
}

type Producer

type Producer interface {
	Publish(topic string, m *Message) error
}

type RabbitMq

type RabbitMq struct {
	ExchangeType    string
	ExchangeKey     string
	DurableExchange bool
	PrefetchCount   int
	PrefetchGlobal  bool

	Secure         bool
	TLSConfig      *tls.Config
	Authentication amqp.Authentication
}

type SubscribeOption

type SubscribeOption func(*SubscribeOptions)

type SubscribeOptions

type SubscribeOptions struct {
	AutoAck bool
	GroupID string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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