queue

package
v0.0.0-...-ec1c8bb Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Context is used to identify the AMQP server in logging
	Context = "AMQP"

	// ExchangeName to use for AMQP queues
	ExchangeName = `fluidity`

	// ExchangeType to use for routing messages inside the queue
	ExchangeType = `topic`

	// EnvQueueAddr is the address to access RabbitMQ.
	EnvQueueAddr = `FLU_AMQP_QUEUE_ADDR`

	// EnvDeadLetterEnabled to disable the use of dead letter queues
	// (disabling with "false" implies disabling retries)
	EnvDeadLetterEnabled = `FLU_AMQP_QUEUE_DEAD_LETTER_ENABLED`

	// EnvMessageRetries to attempt until giving up - defaults to
	// 5 if not set!
	EnvMessageRetries = `FLU_AMQP_QUEUE_MESSAGE_RETRIES`

	// EnvGoroutinesPerQueue for the number of goroutines to run
	// per topic, defaults to 1
	EnvGoroutinesPerQueue = `FLU_AMQP_GOROUTINES_PER_QUEUE`

	// EnvMessageLoggingEnabled to log all incoming messages using a log
	// debug if set to anything other than ""
	EnvMessageLoggingEnabled = `FLU_DEBUG_MESSAGE_LOGGING_ENABLED`
)
View Source
const RandomConsumerPrefixLength = 8

RandomConsumerPrefixLength to append to the worker id

Variables

This section is empty.

Functions

func Finish

func Finish()

Finish up, by clearing the buffer

func GetMessages

func GetMessages(topic string, f func(message Message))

GetMessages from the AMQP server, calling the function each time a message is received. If newTopic is set to true, a new queue name will be generated that will make this useful for receiving messages that would be received over broadcast that is unique to this worker. If it is set to false, every message that would be received is distributed across any worker sharing the same worker id.

func SendMessage

func SendMessage(topic string, content interface{})

SendMessage down a topic, with the JSON form of the content.

func SendMessageBytes

func SendMessageBytes(topic string, content []byte)

SendMessageBytes down a topic, with bytes as content

Types

type Message

type Message struct {
	Topic   string    `json:"topic"`
	Content io.Reader `json:"content"`
}

func (Message) Decode

func (message Message) Decode(decoded interface{})

Jump to

Keyboard shortcuts

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