In-memory message broker in Go over an HTTP API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
client
examples
.gitignore
LICENSE
README.md
main.go

README.md

mqueue (Go)

In-memory message broker in Go over an HTTP API using a concurrent, thread-safe publisher/subscriber architecture with multiple topics.

Installation

$ go get github.com/ridwanmsharif/mqueue
$ cd $GOPATH/src/github.com/ridwanmsharif/mqueue/
$ go build -o mqueue
$ ./mqueue

Listening on :8081, ready for client/terminal use.

Examples/Usage

Subscriber (client library)

  ch, err := client.Subscribe("topic_of_your_choice")
  if err != nil {
    log.Println(err)
    return
  }

  for e := range ch {
    log.Println(string(e))
  }

  log.Println("Channel closed")

Publisher (client library)

  err := client.Publish("topic_of_your_choice", []byte("Arbitrary Message"))
  if err != nil {
      log.Println(err)
  }

Subscriber (command line)

curl -k -i -N -H "Connection: Upgrade" \
    -H "Upgrade: websocket" \
    -H "Host: localhost:8081" \
    -H "Origin:http://localhost:8081" \
    -H "Sec-Websocket-Version: 13" \
    -H "Sec-Websocket-Key: MQ" \
    "https://localhost:8081/sub?topic=
    topic_of_your_choice"

Publisher (command line)

curl -d "Any message you wish to post""http://localhost:8081/pub?topic=topic_of_your_choice"

Disclaimer

Purely experimental project. Designed for learning purposes not production use. This weas my first project in Go, the implementation here is largely based on asim/mq, I'm tracking his incremental progress and repeating the same

Contributing

Bug reports and pull requests are welcome on GitHub at @ridwanmsharif

Author

Ridwan M. Sharif: E-mail, @ridwanmsharif

License

The command line utility is available as open source under the terms of the MIT License