1
0
Fork 0

Improve Daemon interface description

This commit is contained in:
Gregory Eremin 2015-10-14 03:29:44 +03:00
parent c740f13063
commit 98bbbf91f4
1 changed files with 7 additions and 7 deletions

View File

@ -11,23 +11,23 @@ import (
// Daemon is the interface that contains a set of methods required to be
// implemented in order to be treated as a daemon.
type Daemon interface {
// Startup implementation should...
// Startup implementation should:
//
// func (d *DaemonName) Startup() {
// // Set up a panic handler:
// // 1. Set up a panic handler
// b.HandlePanics(func() {
// log.Error("Oh, crap!")
// })
//
// // If the daemon is also a consumer we need to subscribe for topics
// // that would be consumed by the daemon.
// // 2. If the daemon is also a consumer we need to subscribe for
// // topics that would be consumed by the daemon
// b.Subscribe("ProductPriceUpdates", func(p PriceUpdate) {
// log.Printf("Price for %q is now $%.2f", p.Product, p.Amount)
// })
//
// // If the daemon is doing some IO it is a good idea to limit the rate
// // of its execution.
// b.SetRateLimit(10, 1 * time.Second)
// // 3. If the daemon is doing some IO it is a good idea to limit the
// // rate of its execution
// b.LimitRate(10, 1 * time.Second)
// }
Startup()