func NewLooper(_router Router) *Looper { transcript.TraceInformation("creating looper...") _looper := &Looper{} _looper.router = _router go _looper.loop() return _looper }
func NewStreamer(_router Router, _endpoint string) *Streamer { transcript.TraceInformation("creating http streamer (with endpoint `%s`)...", _endpoint) _streamer := &Streamer{} _streamer.router = _router _streamer.server = http.Server{Addr: _endpoint, Handler: _streamer} go _streamer.loop() return _streamer }
func NewTailer(_router Router, _path string) *Tailer { transcript.TraceInformation("creating tailer (with path `%s`)...", _path) _tailer := &Tailer{} _tailer.router = _router _tailer.path = _path go _tailer.loop() return _tailer }
func NewCounter(_router Router, _interval time.Duration) *Counter { transcript.TraceInformation("creating counter (with interval %d ms)...", _interval/time.Millisecond) _counter := &Counter{} _counter.router = _router _counter.interval = _interval _counter.counter = 0 go _counter.loop() return _counter }
func NewConsumer(_router Router, _path string) *Consumer { transcript.TraceInformation("creating consumer (with queue `%s`)...", _path) _pathC := C.CString(_path) _backend := C.pxmq_inbound_channel_create(_pathC) C.free(unsafe.Pointer(_pathC)) if _backend == nil { panic(errors.New("backend creation failed")) } _consumer := &Consumer{ router: _router, backend: _backend, pushChannel: nil, pushIdentifier: nil, } go _consumer.loop() return _consumer }