Project MashlingTM is an open source event-driven microgateway.
Project Mashling highlights include:
- Ultra lightweight: 10-50x times less compute resource intensive
- Event-driven by design
- Complements Service Meshes
- Co-exists with API management platforms in a federated API Gateway model
Project Mashling consists of the following open source repos:
- mashling: This is the main repo that includes the below components
- CLI to build Mashling apps
- Mashling triggers and activities
- Library to build Mashling extensions
- mashling-recipes: This is the repo that includes recipes that illustrate configuration of common microgateway patterns. These recipes are curated and searchable via mashling.io
Additional developer tooling is included in below open source repo that contains the VSCode plugin for Mashling configuration:
- The Go programming language 1.9 or later should be installed.
- Set GOPATH environment variable on your system
- In order to simplify development and dependency management, we're using go dep tool. You can install it by following the instructions here.
- Mashling uses make for building CLI. Make tool doesnt come by default with Windows, it can be installed from here.
git clone -b master --single-branch https://github.com/TIBCOSoftware/mashling.git $GOPATH/src/github.com/TIBCOSoftware/mashling
cd $GOPATH/src/github.com/TIBCOSoftware/mashling
dep ensure -vendor-only
make all
Note: Windows users can execute above commands as is using git-bash terminal.
cd $GOPATH/src/github.com/TIBCOSoftware/mashling
git pull
dep ensure -vendor-only
make all
Note: Windows users can execute above commands as is using git-bash terminal.
A Mashling microgateway is created using the Mashling CLI tool. The tool can be used to create a gateway from an existing mashling.json or to create a simple base gateway to get you started. In this example we will walk you through creating the base/sample gateway.
To create the base gateway, which consists of a REST trigger and a simple event handler flow with a log activity, you use the following commands.
mashling create myApp
cd myApp/bin folder
./myapp
- Mashling will start a REST server
- Test it by sending sample HTTP events eg: http://localhost:9096/pets/2
The built in sample microgateway is based off the following mashling.json. This file can be modified to add additional triggers and event handlers.
{
"mashling_schema": "0.2",
"gateway": {
"name": "demo",
"version": "1.0.0",
"description": "This is the first microgateway app",
"configurations": [],
"triggers": [
{
"name": "rest_trigger",
"description": "The trigger on 'pets' endpoint",
"type": "github.com/TIBCOSoftware/mashling/ext/flogo/trigger/gorillamuxtrigger",
"settings": {
"port": "9096",
"method": "GET",
"path": "/pets/{petId}"
}
}
],
"event_handlers": [
{
"name": "get_pet_success_handler",
"description": "Handle the user access",
"reference": "github.com/TIBCOSoftware/mashling/lib/flow/flogo.json",
"params": {
"uri": "petstore.swagger.io/v2/pet/3"
}
}
],
"event_links": [
{
"triggers": [
"rest_trigger"
],
"dispatches": [
{
"handler": "get_pet_success_handler"
}
]
}
]
}
}
For more details about the REST Trigger go here
For additional documentation on Mashling CLI tool, go here
We welcome all bug fixes and issue reports.
Pull requests are also welcome. If you would like to submit one, please follow these guidelines:
- Code must be gofmt compliant.
- Execute golint on your code.
- Document all funcs, structs and types.
- Ensure that 'go test' succeeds.
Please submit a github issue if you would like to propose a significant change or request a new feature.
$go get github.com/TIBCOSoftware/mashling/cli/...
$cd $GOPATH/src/github.com/TIBCOSoftware/mashling/cli
[optional, only if building from branch]
$git checkout my_branch
[need to manually go get all dependencies for example:]
$go get github.com/xeipuuv/gojsonschema
$go install ./...
Mashling is licensed under a BSD-type license. See license text here.
You can post your questions via GitHub issues