|
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +[](https://goreportcard.com/report/github.com/triggermesh/triggermesh-core) |
| 6 | + |
| 7 | +The TriggerMesh Core components conform the basis for creating event driven applications declaratively at Kubernetes. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +TriggerMesh Core includes 2 components: |
| 12 | + |
| 13 | +* RedisBroker, which uses a backing Redis instance to store events and routes them via Triggers. |
| 14 | +* Trigger, which subscribes to events and push them to your targets. |
| 15 | + |
| 16 | +Events must conform to [CloudEvents spec](https://github.com/cloudevents/spec) using the [HTTP binding](https://github.com/cloudevents/spec/blob/main/cloudevents/bindings/http-protocol-binding.md). |
| 17 | + |
| 18 | +Create a RedisBroker named `demo`. |
| 19 | + |
| 20 | +```console |
| 21 | +kubectl apply -f https://raw.githubusercontent.com/triggermesh/triggermesh-core/main/docs/getting-started/broker.yaml |
| 22 | +``` |
| 23 | + |
| 24 | +Wait until the RedisBroker is ready. It will inform in its status of the URL where events can be ingested. |
| 25 | + |
| 26 | +```console |
| 27 | +kubectl get redisbroker demo |
| 28 | + |
| 29 | +NAME URL AGE READY REASON |
| 30 | +demo http://demo-redisbroker-broker.default.svc.cluster.local 10s True |
| 31 | +``` |
| 32 | + |
| 33 | +To be able to use the broker we will create a Pod that allow us to send events inside the Kubernetes cluster. |
| 34 | + |
| 35 | +```console |
| 36 | +kubectl apply -f https://raw.githubusercontent.com/triggermesh/triggermesh-core/main/docs/getting-started/curl.yaml |
| 37 | +``` |
| 38 | + |
| 39 | +It is possible now to send events to the broker address by issuing curl commands. The response for ingested events must be an `HTTP 200`. |
| 40 | + |
| 41 | +```console |
| 42 | +kubectl exec -ti curl -- curl -v http://demo-redisbroker-broker.default.svc.cluster.local:8080/ \ |
| 43 | + -X POST \ |
| 44 | + -H "Ce-Id: 1234-abcd" \ |
| 45 | + -H "Ce-Specversion: 1.0" \ |
| 46 | + -H "Ce-Type: demo.type1" \ |
| 47 | + -H "Ce-Source: curl" \ |
| 48 | + -H "Content-Type: application/json" \ |
| 49 | + -d '{"hello":"world"}' |
| 50 | +``` |
| 51 | + |
| 52 | +Sockeye is a popular CloudEvents consumer that exposes a web interface with the list of events received while the page is open. We will be creating 2 instances of sockeye, one as the target for consumed events and another one for the Dead Letter Sink. |
| 53 | +A Dead Letter Sink, abbreviated DLS is a destination that consumes events that a subscription was not able to deliver. |
| 54 | + |
| 55 | +```console |
| 56 | +# Target service |
| 57 | +kubectl apply -f https://raw.githubusercontent.com/triggermesh/triggermesh-core/main/docs/getting-started/sockeye-target.yaml |
| 58 | + |
| 59 | +# DLS service |
| 60 | +kubectl apply -f https://raw.githubusercontent.com/triggermesh/triggermesh-core/main/docs/getting-started/sockeye-deadlettersink.yaml |
| 61 | +``` |
| 62 | + |
| 63 | +The Trigger object configures the broker to consume events and send them to a target. The Trigger object can include filters that select which events should be forwarded to the target, and delivery options to configure retries and fallback targets when the event cannot be delivered. |
| 64 | + |
| 65 | +```console |
| 66 | +kubectl apply -f https://raw.githubusercontent.com/triggermesh/triggermesh-core/main/docs/getting-started/trigger.yaml |
| 67 | +``` |
| 68 | + |
| 69 | +The Trigger created above filters by CloudEvents with `type: demo.type1`, if delivery fails it will issue 3 retries and then forward the CloudEvent to the `sokceye-deadlettersink` service. |
| 70 | + |
| 71 | +Using the `curl` Pod again we can send this CloudEvent to the broker, that will pass the filtering and forward the event to the `sockeye-target` service. |
| 72 | + |
| 73 | +```console |
| 74 | +kubectl exec -ti curl -- curl -v http://demo-redisbroker-broker.default.svc.cluster.local:8080/ \ |
| 75 | + -X POST \ |
| 76 | + -H "Ce-Id: 1234-abcd" \ |
| 77 | + -H "Ce-Specversion: 1.0" \ |
| 78 | + -H "Ce-Type: demo.type1" \ |
| 79 | + -H "Ce-Source: curl" \ |
| 80 | + -H "Content-Type: application/json" \ |
| 81 | + -d '{"hello":"world"}' |
| 82 | +``` |
| 83 | + |
| 84 | +## Installation |
| 85 | + |
| 86 | +Devevlopment version might be unstable. |
| 87 | + |
| 88 | +```console |
| 89 | +ko apply -f ./config |
| 90 | +``` |
| 91 | + |
| 92 | +## Usage |
| 93 | + |
| 94 | +### Brokers |
| 95 | + |
| 96 | +TODO |
| 97 | + |
| 98 | +### Triggers |
| 99 | + |
| 100 | +TODO |
| 101 | + |
| 102 | +## Contributing |
| 103 | + |
| 104 | +Please refer to our [guidelines for contributors](CONTRIBUTING.md). |
| 105 | + |
| 106 | +## Commercial Support |
| 107 | + |
| 108 | +TriggerMesh Inc. offers commercial support for the TriggerMesh platform. Email us at <info@triggermesh.com> to get more |
| 109 | +details. |
| 110 | + |
| 111 | +## License |
| 112 | + |
| 113 | +This software is licensed under the [Apache License, Version 2.0][asl2]. |
| 114 | + |
| 115 | +Additionally, the End User License Agreement included in the [`EULA.pdf`](EULA.pdf) file applies to compiled |
| 116 | +executables and container images released by TriggerMesh Inc. |
| 117 | + |
| 118 | +[asl2]: https://www.apache.org/licenses/LICENSE-2.0 |
0 commit comments