rabbit

package
v0.0.0-...-38323af Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ContentType = "text/json"

RabbitURI contains the connection url

Variables

This section is empty.

Functions

func Consumer

func Consumer(name int, input <-chan amqp.Delivery, out chan models.Record)

Consumer is a worker to receive and serialize messages

func ExtractCsvRecords

func ExtractCsvRecords(r io.Reader, out chan models.Record) int

ExtractCsvRecords receives a io.Reader and sends back csv records through a channel

func Publisher

func Publisher(name int, mq *RabbitMQ, input chan models.Record, wg *sync.WaitGroup)

Types

type RabbitMQ

type RabbitMQ struct {
	Conn    *amqp.Connection
	Channel *amqp.Channel
	Queue   amqp.Queue
}

Rabbit contains rabbitmq params

func Init

func Init(url string, queueName string) (*RabbitMQ, error)

Init setups RabbitMQ

func (*RabbitMQ) Close

func (r *RabbitMQ) Close()

Close RabbitMQ's amqp.Connection and amqp.Channel

func (*RabbitMQ) PublishRecord

func (r *RabbitMQ) PublishRecord(record models.Record) error

PublishRecord sends a record to queue with name equal to queue on channel

Jump to

Keyboard shortcuts

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