communicator

package
v3.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: BSD-4-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RetryClosure = func() {
	retryIn := 2
	log.Printf("Retrying to connect RabbitMQ in %v seconds", retryIn)
	time.Sleep(time.Second)
}

Functions

This section is empty.

Types

type Communicator

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

Communicator represents an AMQP broker

func NewCommunicator

func NewCommunicator(cnf *MessageBusConfig) *Communicator

func (*Communicator) Publish

func (communicator *Communicator) Publish(msg *SendMessage) error

Publish places a new message on the default queue

func (*Communicator) StartConsuming

func (communicator *Communicator) StartConsuming(consumerTag string, taskProcessor TaskProcessor) (bool, error)

StartConsuming enters a loop and waits for incoming messages

func (*Communicator) StopConsuming

func (communicator *Communicator) StopConsuming()

StopConsuming quits the loop

type MessageBusConfig

type MessageBusConfig struct {
	Broker       string
	Exchange     string
	ExchangeType string
	DefaultQueue string
	BindingKeys  []string
}

Config holds all configuration for our program

type TaskProcessor

type TaskProcessor interface {
	Process(msg *RecvMessage) error
}

Jump to

Keyboard shortcuts

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