Documentation
¶
Index ¶
Constants ¶
View Source
const ( NEW ReqAction = "NEW" CANCEL = "CANCEL" REPLACE = "REPLACE" )
Variables ¶
View Source
var JobQueue = make(chan Job)
JobQueue is a buffered channel that we can send work requests on.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct { // A pool of workers channels that are registered with the dispatcher WorkerPool chan chan Job // contains filtered or unexported fields }
func NewDispatcher ¶
func NewDispatcher(maxWorkers int) *Dispatcher
func (*Dispatcher) Run ¶
func (d *Dispatcher) Run()
type KafkaConsumer ¶
type KafkaConsumer struct { Consumer *kafka.Consumer Topics []string // contains filtered or unexported fields }
KafkaConsumer represents the kafka consumer
func NewKafkaConsumer ¶
func NewKafkaConsumer(broker, group string, topics []string) KafkaConsumer
func (KafkaConsumer) ConsumeTopics ¶
func (k KafkaConsumer) ConsumeTopics()
func (KafkaConsumer) Stop ¶
func (k KafkaConsumer) Stop()
Stop signals the worker to stop listening for work requests.
type Payload ¶
type Payload struct { ID string `json:"id"` Type ReqType `json:"type"` Action ReqAction `json:"action"` Data json.RawMessage `json:"data"` }
type Worker ¶
type Worker struct { WorkerPool chan chan Job JobChannel chan Job // contains filtered or unexported fields }
Worker represents the worker that executes the job
Click to show internal directories.
Click to hide internal directories.