Skip to content

Instantly share code, notes, and snippets.

@soheilhy soheilhy/queue.go
Last active Aug 29, 2015

Embed
What would you like to do?
Register taskq handlers (simple)
app := beehive.NewApp("taskq")
app.Handle(Enque{}, EnQHandler{})
app.Handle(Deque{}, DeQHandler{})
app.Handle(Ack{}, AckHandler{})
app.Handle(Timeout{}, TimeoutHandler{
ExpDur: 60 * time.Second,
})
// Detached runs a local go-routine, and NewTimer
// creates a "detached" handler that calls the function
// every 30 seconds.
app.Detached(beehive.NewTimer(30*time.Second, func() {
beehive.Emit(Timeout(time.Now()))
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.