Skip to content

buptmiao/msgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

msgo

Build Status Coverage Status Go Report Card Docker Repository on Quay

A high performance message middleware, based on pub/sub model.

Install

git get -u github.com/buptmiao/msgo

Features

  • Msgo uses gogoprotobuf as binary interface, gogoprotobuf is an optimized version of goprotobuf with high performance on marshaling and unmarshaling msgs and lower memory cost. For more information about gogoprotobuf, see this benchmark

  • Support batch messages pub/sub, producer can publish multiple messages at a time. The broker can compose messages from different producer into a batch package, and deliver them to a subscriber at a time.

  • Support REST API, which is used to deliver messages and monitor the runtime statistics of msgo. Msgo exports the metrics as prometheus expected, that means we can collect the metrics into prometheus, and monitor the state of msgo.

  • Msgo supports two kind of message type: persist and non-persist, with non-persist type, messages are stored in memory, and with persist type, messages are stored into disk. Msgo supports two kinds of persistence strategy, Boltdb and customized AOF storage which is inspired by redis aof.

How to use

subscribe a topic with a filter

consumer := client.NewConsumer(addr)  //addr is the address of broker, eg: localhost:13001
consumer.Subscribe("msgo", "filter", func(m ...*msg.Message) error {
    for _, v := range m {
        fmt.Println(string(v.GetBody()))
    }
    return nil
})

publish a message

producer := client.NewProducer(addr)
_ = producer.PublishFanout("msgo", "filter", []byte("hello world"))

then the subscriber will received a message "hello world".

Please see the demo for details.

Docker

docker pull buptmiao/msgo
docker run --name broker -p 13000:13000 -p 13001:13001 buptmiao/msgo

More updates

About

Msgo is an efficient message middleware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published