rabbit

package
v0.0.0-...-2583da8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPrefetchCount = 1
	DefaultPrefetchSize  = 0
)
View Source
var (
	ErrNoChannelFound error = errors.New("no channel found. Please connect to exchange first")

	ErrAmqpURICannotBeEmpty error = errors.New("amqpURI cannot be empty")

	ErrExchangeNameCannotBeEmpty error = errors.New("exchangeName cannot be empty")

	ErrExchangeTypeCannotBeEmpty error = errors.New("exchangeType cannot be empty")
)

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Connect() (MqContext, error)
	UseConnection(connection *amqp.Connection)
}

type Consumer

type Consumer interface {
	StartConsuming(consumerTag string) error
	StartConsumingBy(consumerTag string, handle Handle) error
}

type ContextBuilder

type ContextBuilder interface {
	WithExchange(name, exchangeType string) MqContext
	WithQueue(queueName, key string) MqContext
	WithHandle(handle Handle) MqContext
}

type FromJSON

type FromJSON func(string) (interface{}, error)

type Handle

type Handle func(*Message)

type Message

type Message struct {
	ID          string
	MessageType string
	Body        string
	ContentType string
	Created     time.Time
}

func NewMessage

func NewMessage(i interface{}) (*Message, error)

type MqContext

type MqContext interface {
	ContextBuilder
	Connector
	Publisher
	Consumer
}

func NewContext

func NewContext(amqpURI string) MqContext

func WithContext

func WithContext(rCtx MqContext) MqContext

type Publisher

type Publisher interface {
	Publish(message Message) error
}

type ToJSON

type ToJSON func(interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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