service

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Body    []byte
	Headers []byte
	// contains filtered or unexported fields
}

Message defines a data that can be sent

type Publisher

type Publisher interface {
	Send(dest string, message Message) error
	Shutdown()
}

Publisher defines the functions that a message broker must use

type Service

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

Service is capable of sending messages to a configured broker

func New

func New(publisher Publisher, cfg *config.Config) *Service

New will configure a new service that can send messages

func (*Service) Run

func (s *Service) Run(body, headers []byte) error

Run will send the configured number of messages to the broker

func (*Service) Shutdown

func (s *Service) Shutdown()

Shutdown will cleanly shutdown brokers