interfaces

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ExchangeTypeDirect  ExchangeType = iota
	ExchangeTypeFanout               = 1
	ExchangeTypeTopic                = 2
	ExchangeTypeHeaders              = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeType

type ExchangeType int64

Message Exchange Types

type Manager

type Manager interface {
	Init() error
	Retry() error
	CreatePublisher(options PublisherOptions) (*Publisher, error)
	CreateSubscriber(options SubscriberOptions) (*Subscriber, error)
	GetPublisherByName(name string) (*Publisher, error)
	GetSubscriberByName(name string) (*Subscriber, error)
	PublishMessageByName(name string, data []byte) error
	DeletePublisher(name string) error
	DeleteSubscriber(name string) error
	Teardown() error
}

Interface to the Rabbit Manager which keeps track of all Publishers and Subscribers for a given instance

type ManagerOptions

type ManagerOptions struct {
	RabbitURI      string
	DeleteWarnings bool
}

Configuration Options for Rabbit Subscriber/Publisher

type Publisher

type Publisher interface {
	GetName() string
	Init() error
	Retry() error
	SendMessage([]byte) error
	Teardown() error
}

Object interfaces

type PublisherOptions

type PublisherOptions struct {
	Name string
	Type ExchangeType

	// init
	Durable     bool
	AutoDeleted bool
	Internal    bool

	// teardown
	IfUnused       bool
	DeleteWarnings bool

	// common
	NoWait bool
}

type RabbitMessageHandler

type RabbitMessageHandler interface {
	ProcessMessage(byData []byte) error
}

Each Subscriber implements this message handler which serves as a callback. This function is called when the Rabbit Subscriber receives a message from a named Subscriber

type Subscriber

type Subscriber interface {
	GetName() string
	Init() error
	Retry() error
	Teardown() error
}

type SubscriberOptions

type SubscriberOptions struct {
	Name    string
	Type    ExchangeType
	Handler *RabbitMessageHandler

	// init
	Durable     bool
	AutoDeleted bool
	Internal    bool
	Exclusive   bool
	NoLocal     bool
	NoAck       bool

	// teardown
	IfUnused       bool
	IfEmpty        bool
	DeleteWarnings bool

	// common
	NoWait bool
}

Jump to

Keyboard shortcuts

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