Update README.md
This commit is contained in:
parent
02eee3389a
commit
32434cc7cd
26
README.md
26
README.md
|
@ -30,24 +30,24 @@ Use the `MessageBus` type either directly:
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log"
|
||||
|
||||
"github.com/prologic/msgbus"
|
||||
"github.com/prologic/msgbus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
m := msgbus.NewMessageBus()
|
||||
m.Put("foo", m.NewMessage([]byte("Hello World!")))
|
||||
m := msgbus.NewMessageBus()
|
||||
m.Put("foo", m.NewMessage([]byte("Hello World!")))
|
||||
|
||||
msg, ok := m.Get("foo")
|
||||
if !ok {
|
||||
log.Printf("No more messages in queue: foo")
|
||||
} else {
|
||||
log.Printf(
|
||||
"Received message: id=%s topic=%s payload=%s",
|
||||
msg.ID, msg.Topic, msg.Payload,
|
||||
)
|
||||
}
|
||||
msg, ok := m.Get("foo")
|
||||
if !ok {
|
||||
log.Printf("No more messages in queue: foo")
|
||||
} else {
|
||||
log.Printf
|
||||
"Received message: id=%s topic=%s payload=%s",
|
||||
msg.ID, msg.Topic, msg.Payload,
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue