broker-gateway
![LICENSE](https://img.shields.io/github/license/rudeigerc/broker-gateway.svg)
The broker gateway of project Matthiola, a distributed commodities OTC electronic trading system, instructed by Morgan Stanley.
Architecture
- Receiver
- Matcher
- Server (HTTP Server)
- Broadcaster (WebSocket Server)
![Architecture](https://github.com/project-matthiola/broker-gateway/raw/v1.0.0/asset/Architecture.png)
Quick Start
Docker Compose
$ docker-compose up
Build
$ brew install dep
$ dep ensure
$ go build
$ ./broker-gateway --help
Run
Usage:
broker-gateway [command]
Available Commands:
broadcaster Run WebSocket server
help Help about any command
matcher Run matcher
receiver Run receiver
sender Run sender
server Run HTTP server
Flags:
-c, --config string config file (default "config/config.toml")
-h, --help help for broker-gateway
Use "broker-gateway [command] --help" for more information about a command.
Config
See config/config.toml
.
Requirement
Microservices
Micro
Micro is a toolkit for cloud-native development. It helps you build future-proof application platforms and services.
$ go get -u github.com/micro/micro
Service Discovery
Consul
Consul is a tool for service discovery and configuration. Consul is distributed, highly available, and extremely scalable.
$ brew install consul
$ consul agent -dev
API Gateway
Go API
Go API is a pluggable API framework.
It builds on go-micro and includes a set of packages for composing HTTP based APIs.
# The HTTP handler with web socket support included
$ micro api --namespace=github.com.rudeigerc.broker-gateway --handler=web
- HTTP Server
/server
- WebSocket Server
/broadcaster
Database
MySQL
$ brew install mysql
$ brew services start mysql
Store
etcd
etcd is a distributed reliable key-value store for the most critical data of a distributed system.
$ brew install etcd
$ brew services start etcd
Message Queue
NSQ
NSQ is a realtime distributed messaging platform.
$ brew install nsq
- In one shell, start
nsqlookupd
:
$ nsqlookupd --broadcast-address=127.0.0.1
- In another shell, start
nsqd
:
$ nsqd --lookupd-tcp-address=127.0.0.1:4160 --broadcast-address=127.0.0.1
- In another shell, start
nsqadmin
:
$ nsqadmin --lookupd-http-address=127.0.0.1:4161
Docs
See docs and api-docs.
License
MIT