Fast and reliable message transport between microservices!
🚧 Disclaimer: metro is under active development currently. The first release is expected soon. Watch this space for updates.
metro is an asynchronous pub-sub messaging platform that decouples producers and consumers of messages and forms the backbone for event-driven applications. metro offers durable message storage and real-time message delivery with high availability, fault-tolerance and consistent performance at scale.
Clone the repo with submodules
git clone --recurse-submodules -j8 https://github.com/razorpay/metro
cd metroInstall dependencies
make depsGenerate go bindings from proto definitions
make proto-generateBuild the binary
make go-build-metroThe binary can be found at bin/ directory
Before running metro components, bring up the dependent datastores
make dev-docker-datastores-upThe datastores can be brough down as well with this command
make dev-docker-datastores-downVarious metro components can now be run. metro has 4 components, all components are part of same binary and can be ran using a cmd param component
Running Metro Web component
bin/metro -component web
Running Metro Worker component
bin/metro -component worker
Running OpenAPI Server
bin/metro -component openapi-server
After cloning the repository, run
make docker-build-metroThe first step is to bring the dependent datastores up (kafka, zookeeper, consul and pulsar)
make dev-docker-datastores-upThe metro image along with the monitoring stack, prometheus and jaeger, can be run as
make dev-docker-upTo bring the setup down
make dev-docker-downTo rebuild
make dev-docker-rebuildMake sure dependents datastores(consul, kafka, zookeeper) are running and accessible via localhost. Refer above section on how to bring up datastores using docker.
Copy dev.toml.sample to dev.toml
cp config/dev.toml.sample config/dev.tomlRun metro web
make dev-up app=webRun metro worker
make dev-up app=worker metro runs unit tests, golint and goimports check in the continuous integration (CI) pipeline.
You can locally test these changes by running the following make targets
golint check
make lint-checkgoimports check
make goimports-checkYou can also apply goimports changes locally by doing the following
make goimportsRunning unit tests
make test-unitIntegration tests are run as part of continuous integration on github actions. They test end to end integration of various metro components along with datastores.
Integration tests can also be run locally
Before running them locally, make sure metro is running locally. After which, run the following make target
make test-integrationCompatibility tests are also run as part of continuous integration to test compatibility against google pub/sub.
To run them locally, make sure metro is running locally along with google pub/sub emulator.
To bring up the google pub/sub emulator, run the following
make dev-docker-emulator-upAfter which, run the following make target
make test-compatTo update the submodule to the latest remote commit
git submodule update --remote --mergeThe default ports for various services in metro
- gRPC endpoint on port 8081
grpc-gatewayHTTP endpoint on port 8082- swagger docs on port 3000