worker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	Size int

	EventsChannel <-chan collection.CollectRequest
	// contains filtered or unexported fields
}

Pool spawn goroutine as much as Size that will listen to EventsChannel. On Close, wait for all data in EventsChannel to be processed.

func CreateWorkerPool

func CreateWorkerPool(size int, eventsChannel <-chan collection.CollectRequest, deliveryChannelSize int, kafkaProducer publisher.KafkaProducer) *Pool

CreateWorkerPool create new Pool struct given size and EventsChannel worker.

func (*Pool) FlushWithTimeOut

func (w *Pool) FlushWithTimeOut(timeout time.Duration) bool

FlushWithTimeOut waits for the workers to complete the pending the messages to be flushed to the publisher within a timeout. Returns true if waiting timed out, meaning not all the events could be processed before this timeout.

func (*Pool) StartWorkers

func (w *Pool) StartWorkers()

StartWorkers initialize worker pool as much as Pool.Size

Jump to

Keyboard shortcuts

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