To install the package, run:
go get github.com/go-zoox/mq
import (
"github.com/go-zoox/mq"
)
func main(t *testing.T) {
m := mq.New(&mq.Config{
RedisHost: <RedisHost>,
RedisPort: <RedisPort>,
RedisUsername: <RedisUsername>,
RedisPassword: <RedisPassword>,
RedisDB: <RedisDB>,
})
m.Consume(context.TODO(), "default", func(msg *mq.Message) error {
logger.Infof("received message: %s", string(msg.Body))
return nil
})
}
import (
"github.com/go-zoox/mq"
)
func main(t *testing.T) {
m := mq.New(&mq.Config{
RedisHost: <RedisHost>,
RedisPort: <RedisPort>,
RedisUsername: <RedisUsername>,
RedisPassword: <RedisPassword>,
RedisDB: <RedisDB>,
})
m.Send(context.TODO(), &mq.Message{
Topic: "default",
Body: []byte("hello world"),
})
}
GoZoox is released under the MIT License.