6
0
mirror of https://git.mills.io/prologic/msgbus.git synced 2024-06-26 00:38:55 +00:00
prologic-msgbus/README.md

69 lines
1.9 KiB
Markdown
Raw Normal View History

2017-08-07 08:15:56 +00:00
# msgbus
A distirbuted, scalable Message Bus server and library written in Go
2017-06-08 05:01:09 +00:00
**WIP:** THis is still highly experimental and not fit for production use.
2017-08-07 08:15:56 +00:00
**Update:** (*2017-08-07*) This is now being used by [autodock](https://github.com/prologic/autodock) and is undergoing heavy development to deliver what is laid out here.
2017-06-08 05:01:09 +00:00
## Install
```#!bash
$ go install github.com/prologic/msgbus/...
```
## Usage
2017-06-08 14:47:16 +00:00
Run the message bus daemon/server:
2017-06-08 05:01:09 +00:00
```#!bash
$ msgbusd
2017-08-07 08:15:56 +00:00
2017/08/07 01:11:16 [msgbus] Subscribe id=[::1]:55341 topic=foo
2017/08/07 01:11:22 [msgbus] PUT id=0 topic=foo payload=hi
2017/08/07 01:11:22 [msgbus] NotifyAll id=0 topic=foo payload=hi
2017/08/07 01:11:26 [msgbus] PUT id=1 topic=foo payload=bye
2017/08/07 01:11:26 [msgbus] NotifyAll id=1 topic=foo payload=bye
2017/08/07 01:11:33 [msgbus] GET topic=foo
2017/08/07 01:11:33 [msgbus] GET topic=foo
2017/08/07 01:11:33 [msgbus] GET topic=foo
2017-06-08 05:01:09 +00:00
```
Subscribe to a topic using the message bus client:
```#!bash
$ msgbus sub foo
2017-08-07 08:15:56 +00:00
2017/08/07 01:11:22 [msgbus] received message: id=0 topic=foo payload=hi
2017/08/07 01:11:26 [msgbus] received message: id=1 topic=foo payload=bye
2017-06-08 05:01:09 +00:00
```
2017-06-08 14:47:16 +00:00
Send a few messages with the message bus client:
2017-06-08 05:01:09 +00:00
```#!bash
2017-08-07 08:15:56 +00:00
$ msgbus pub foo hi
$ msgbus pub foo bye
```
You can also manually pull messages using the client:
```#!bash
$ msgbus pull foo
2017/08/07 01:11:33 [msgbus] received message: id=0 topic=foo payload=hi
2017/08/07 01:11:33 [msgbus] received message: id=1 topic=foo payload=bye
2017-06-08 05:01:09 +00:00
```
2017-08-07 08:15:56 +00:00
> This is slightly different from a listening subscriber (*using websockets*) where messages are pulled directly.
2017-06-08 05:01:09 +00:00
## Design
Design decisions so far:
2017-08-07 08:15:56 +00:00
* In memory queues (*may extend this with interfaces and persistence*)
2017-06-08 05:01:09 +00:00
* HTTP API
* Websockets for realtime push of events
2017-08-07 08:15:56 +00:00
* Sequence ID Message tracking
* Pull and Push model
## License
2017-06-08 05:01:09 +00:00
2017-08-07 08:15:56 +00:00
msgbus is licensed under the [MIT License](https://github.com/prologic/msgbus/blob/master/LICENSE)