Getting Started¶
Installation¶
Or build a container image with Docker or Podman: task image:build (with Task) or docker build -t tram:dev .. Run task to see all development tasks, e.g. for tests and benchmarks; CONTRIBUTING.md explains them.
Run¶
The container image starts the server with both APIs listening on all interfaces of the container: docker run --rm -p 8080:8080 -p 50051:50051 tram:dev.
By default the HTTP API listens on localhost:8080 and the gRPC API on localhost:50051. --log-level sets the log level (debug, info, warn or error; default info). See ./tram server --help for all flags.
Example API Usage¶
Create a Simple Pipeline¶
This example creates a pipeline with:
- Source: generator (emits events every 5 seconds)
- Stages: None
- Sinks: debug (logs to stdout)
curl -X PUT http://localhost:8080/v1/streams/my-pipeline \
-H "Content-Type: application/json" \
-d '{
"stream": {
"name": "my-pipeline",
"source": {
"name": "event-generator",
"type": "generator",
"spec": {
"interval": "5s"
}
},
"sinks": [
{
"name": "console",
"type": "debug",
"from": "event-generator"
}
]
}
}'
Create a Pipeline with Stages¶
This example adds a noop stage between the source and sinks:
curl -X PUT http://localhost:8080/v1/streams/processing-pipeline \
-H "Content-Type: application/json" \
-d '{
"stream": {
"name": "processing-pipeline",
"source": {
"name": "events-source",
"type": "generator",
"spec": {
"interval": "1s"
}
},
"stages": [
{
"name": "passthrough",
"type": "noop",
"from": "events-source"
}
],
"sinks": [
{
"name": "console",
"type": "debug",
"from": "passthrough"
}
]
}
}'