|
1 | 1 | # Kafmesh |
2 | 2 |
|
3 | | -Kafmesh is... |
| 3 | +Kafmesh is a [Kafka] streaming and observability framework built for go. It's |
| 4 | +built using [Goka] and generates strongly-typed wrappers to Goka's streaming |
| 5 | +concepts that are easy to write and unit-test. |
4 | 6 |
|
5 | | -## Components |
| 7 | +TODO: note on requirement for protocol buffers |
6 | 8 |
|
7 | | -### Kafmesh-Discovery |
| 9 | +## Features |
8 | 10 |
|
9 | | -Service running in K8s that scrapes all pods in the cluster to discover kafmesh-enabled services. It then reports relevant information to Neo4J where it can be used in GUI. |
| 11 | + * **gRPC-like code generation for streaming services** |
| 12 | + |
| 13 | + Kafmesh components are defined in yaml files and generated via |
| 14 | + `kafmesh-gen`. The generated code makes it easy to unit test streaming |
| 15 | + services. |
| 16 | + |
| 17 | + * **Discovery api to aggregate multiple running services into a single view** |
| 18 | + |
| 19 | + Kafmesh defines discovery via a grpc service. All running services |
| 20 | + implement this api and will respond with the parts of the service that |
| 21 | + are currently running in process. |
| 22 | + |
| 23 | + * **Stream visualizer and reading with kafql** |
| 24 | + |
| 25 | +## Getting Started |
| 26 | + |
| 27 | +### Installation |
| 28 | + |
| 29 | +Install the kafmesh generator by using: |
| 30 | + |
| 31 | +`go get -u github.com/syncromatics/kafmesh/cmd/kafmesh-gen` |
| 32 | + |
| 33 | +### Concepts |
| 34 | + |
| 35 | +A kafmesh service is built from components that have specific functions. A |
| 36 | +component is made up of different streaming objects |
| 37 | + |
| 38 | + * **Source** |
| 39 | + |
| 40 | + A source is how data gets into kafka. This could be from a grpc service |
| 41 | + getting information from different sources, such as clicks from a |
| 42 | + webpage, gps positions from vehicles, anything you would need. This is a |
| 43 | + strongly typed wrapper around the [Goka |
| 44 | + Emitter](https://github.com/lovoo/goka#concepts) concept |
| 45 | + |
| 46 | +* **Processor** |
| 47 | + |
| 48 | + A processor is where the bulk of the stream processing takes place. This is |
| 49 | + a strongly typed wrapper around the [Goka |
| 50 | + Processor](https://github.com/lovoo/goka#concepts) concept. |
| 51 | + |
| 52 | +* **View** |
| 53 | + |
| 54 | + A view is a look into what kafka is storing for a particular topic. It takes a feed from a kafka topic and provides a key/value datastore. This is a strongly typed wrapper aroudn the [Goka View](https://github.com/lovoo/goka#concepts) concept. |
| 55 | + |
| 56 | +* **ViewSource** |
| 57 | + |
| 58 | + View source will keep a kafka compacted topic in sync with an external source. |
| 59 | + |
| 60 | +* **ViewSink** |
| 61 | + |
| 62 | + A view sink will sink a kafka compacted topic into a sink. |
| 63 | + |
| 64 | +* **Sink** |
| 65 | + |
| 66 | + A sink will ship kafka messages to an external datastore such as a database. |
| 67 | + |
| 68 | +## Usage |
| 69 | + |
| 70 | +You can use kafmesh-gen by running |
| 71 | + |
| 72 | +`kafmesh-gen docs/definition.yaml` |
| 73 | + |
| 74 | +### Example service |
| 75 | + |
| 76 | +See [kafmesh-example] for a complete usage demo. |
| 77 | + |
| 78 | +docs/definition.yaml |
| 79 | +```yaml |
| 80 | +name: exampleService |
| 81 | +description: A example kafmesh service. |
| 82 | + |
| 83 | +output: |
| 84 | + package: definitions |
| 85 | + path: internal/definitions |
| 86 | + module: example-service |
| 87 | + |
| 88 | +messages: |
| 89 | + protobuf: |
| 90 | + - ../protos |
| 91 | + |
| 92 | +components: |
| 93 | + - ./components/*.yaml |
| 94 | + |
| 95 | +defaults: |
| 96 | + partition: 10 |
| 97 | + replication: 3 |
| 98 | + retention: 24h |
| 99 | + segment: 12h |
| 100 | + |
| 101 | +``` |
| 102 | +docs/components/math.yaml |
| 103 | +```yaml |
| 104 | +name: math |
| 105 | +description: Does some simple math. |
| 106 | + |
| 107 | +sources: |
| 108 | + - message: userId.click |
| 109 | + |
| 110 | +processors: |
| 111 | + - name: total clicks |
| 112 | + inputs: |
| 113 | + - message: userId.click |
| 114 | + outputs: |
| 115 | + - message: userId.totalClicks |
| 116 | + persistence: |
| 117 | + - message: userId.totalClicksState |
| 118 | + |
| 119 | +views: |
| 120 | + - message: userId.totalClicks |
| 121 | + |
| 122 | +``` |
| 123 | + |
| 124 | +## License |
| 125 | + |
| 126 | +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details |
| 127 | + |
| 128 | +## Acknowledgments |
| 129 | + |
| 130 | +* [goka](https://github.com/lovoo/goka) A big shout out for goka doing the hard part of building out a kafka streaming service for go. |
| 131 | + |
| 132 | +* [Visual Studio Code](https://code.visualstudio.com/) for just being an all around great editor |
| 133 | + |
| 134 | +[Kafka]: https://kafka.apache.org/ |
| 135 | +[Goka]: https://github.com/lovoo/goka |
| 136 | +[kafmesh-example]: https://github.com/syncromatics/kafmesh-example |
0 commit comments