Add topic argument to Publisher.Publish function
This commit is contained in:
parent
437c60b018
commit
9269f41051
|
@ -118,12 +118,12 @@ func (d *BaseDaemon) Subscribe(topic string, fun interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish sends a message to the publisher.
|
// Publish sends a message to the publisher.
|
||||||
func (d *BaseDaemon) Publish(msg []byte) {
|
func (d *BaseDaemon) Publish(topic string, msg []byte, meta interface{}) {
|
||||||
if d.publisher == nil {
|
if d.publisher == nil {
|
||||||
panic(errMissingPublisher)
|
panic(errMissingPublisher)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.publisher.Publish(msg)
|
d.publisher.Publish(topic, msg, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LimitRate limits the daemons' processing rate.
|
// LimitRate limits the daemons' processing rate.
|
||||||
|
|
|
@ -47,7 +47,7 @@ type Streamer interface {
|
||||||
// Publisher is the interface that wraps message publishers. Error handling
|
// Publisher is the interface that wraps message publishers. Error handling
|
||||||
// should be provided by the implementation. Feel free to panic.
|
// should be provided by the implementation. Feel free to panic.
|
||||||
type Publisher interface {
|
type Publisher interface {
|
||||||
Publish(msg []byte)
|
Publish(topic string, msg []byte, meta interface{})
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue