Skip to content

ridwanmsharif/mqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

In-memory message broker in Go over an HTTP API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages