pika

package module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToTopic

func AppendToTopic(key, str string) string

func StartConsumer added in v0.6.1

func StartConsumer[T any](consumer Consumer[T], r *RabbitConnector) error

func StartNotifier added in v0.7.1

func StartNotifier[T any](r *RabbitConnector, notifier Notifier[T]) error

Types

type Consumer

type Consumer[T any] interface {
	Options() ConsumerOptions
	HandleMessage(T) error
}

type ConsumerOptions

type ConsumerOptions struct {
	Exchange  string
	Topic     string
	QueueName string
	// contains filtered or unexported fields
}

func NewConsumerOptions added in v0.5.2

func NewConsumerOptions(exchange, topic, queue string) ConsumerOptions

func (ConsumerOptions) HasRetry added in v0.5.0

func (co ConsumerOptions) HasRetry() bool

func (ConsumerOptions) WithRetry added in v0.5.0

func (co ConsumerOptions) WithRetry(retries int, interval time.Duration) ConsumerOptions

type ConsumerRetry added in v0.6.1

type ConsumerRetry[T any] struct {
	// contains filtered or unexported fields
}

type NotificationOptions

type NotificationOptions struct {
	Exchange string
	Topic    string
	Interval time.Duration
}

type Notifier

type Notifier[T any] interface {
	Options() NotificationOptions
	Stop() bool
	Notify() (T, error)
}

type Publisher

type Publisher[T any] struct {
	// contains filtered or unexported fields
}

func CreatePublisher added in v0.7.1

func CreatePublisher[T any](r *RabbitConnector, options PublisherOptions) (*Publisher[T], error)

func (Publisher[T]) Publish

func (p Publisher[T]) Publish(message T) error

type PublisherOptions

type PublisherOptions struct {
	Exchange string
	Topic    string
}

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any]() *Queue[T]

func (*Queue[T]) Dequeue

func (q *Queue[T]) Dequeue() *T

func (*Queue[T]) DequeueNoWait added in v0.5.1

func (q *Queue[T]) DequeueNoWait() *T

func (*Queue[T]) Length

func (q *Queue[T]) Length() int

func (*Queue[T]) PeakAt

func (q *Queue[T]) PeakAt(i int) *T

func (*Queue[T]) Peek

func (q *Queue[T]) Peek() *T

func (*Queue[T]) Queue

func (q *Queue[T]) Queue(e *T)

type RabbitConnector

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

func NewConnector

func NewConnector() *RabbitConnector

func (RabbitConnector) Channel

func (rc RabbitConnector) Channel() (*amqp.Channel, error)

func (*RabbitConnector) Connect

func (rc *RabbitConnector) Connect(url string) error

func (RabbitConnector) Disconnect

func (rc RabbitConnector) Disconnect() error

Jump to

Keyboard shortcuts

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