workers

package
v0.2.3-0...-5ed8acd Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package workers holds the main application logic worker, that listens to read messages and sends then to producer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeWorker

type BridgeWorker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BridgeWorker contains data for bridge worker that does the actual job - handles messages transfer from RabbitMQ to Kafka

func NewBridgeWorker

func NewBridgeWorker(config config.WorkerConfig, storage storage.PersistentStorage, producer producer.Producer, statsClient client.Client) (*BridgeWorker, error)

NewBridgeWorker creates instance of BridgeWorker

func (*BridgeWorker) Close

func (w *BridgeWorker) Close() error

Close closes worker resources

func (*BridgeWorker) Execute

func (w *BridgeWorker) Execute()

Execute runs the service logic once in sync way

func (*BridgeWorker) Go

func (w *BridgeWorker) Go(ctx context.Context)

Go runs the service forever in async way in go-routine

func (*BridgeWorker) MessageHandler

func (w *BridgeWorker) MessageHandler(body []byte, pipe config.Pipe) error

MessageHandler is a handler function for new messages from AMQP

type Worker

type Worker interface {
	// Execute runs the service logic once in sync way
	Execute()
	// Go runs the service forever in async way in go-routine
	Go(interrupt chan bool)
	// Close closes worker resources
	Close() error
}

Worker is public interface for all worker services

Jump to

Keyboard shortcuts

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