Skip to content

Instantly share code, notes, and snippets.

@jaehue
Created December 18, 2017 16:04
Show Gist options
  • Select an option

  • Save jaehue/ad6a9ad357f72226bf047b0217932096 to your computer and use it in GitHub Desktop.

Select an option

Save jaehue/ad6a9ad357f72226bf047b0217932096 to your computer and use it in GitHub Desktop.
이벤트브로커에서 이벤트 처리
func (j *Job) Run(in <-chan *sarama.ConsumerMessage) <-chan *sarama.ConsumerMessage {
out := make(chan *sarama.ConsumerMessage)
for msg := range in {
wg := sync.WaitGroup{}
for _, eh := range j.eventHandlers {
wg.Add(1)
go func(eh *eventbroker.EventHandler) {
defer wg.Done()
/************
* 이벤트 처리 *
************/
}(eh)
}
wg.Wait()
out <- msg
}
return out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment