Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lizrice/hello-cloudevents
A very quick demonstration of CloudEvents
https://github.com/lizrice/hello-cloudevents
cloudevents kubernetes
Last synced: 8 days ago
JSON representation
A very quick demonstration of CloudEvents
- Host: GitHub
- URL: https://github.com/lizrice/hello-cloudevents
- Owner: lizrice
- License: apache-2.0
- Created: 2019-09-10T08:28:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-17T08:13:46.000Z (about 5 years ago)
- Last Synced: 2024-10-12T12:21:42.672Z (about 1 month ago)
- Topics: cloudevents, kubernetes
- Language: Go
- Homepage:
- Size: 10.4 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hello-cloudevents
CloudEvents is a common format for events. This is a very simple demo showing how you can pass an event through an event gateway.
## Executables
These use https://github.com/cloudevents/sdk-go.
`receiver` receives an event
`sender` generates an eventDepending on environment variables `sender` can send directly to receiver, or via an event gateway.
Build with ```GOOS=linux go build .``` run in `sender` and `receiver` directories.
## Set up the event gateway
The `yaml` directory has YAML for etcd and the event-gateway (which uses etcd for storage).
## Event Gateway API
[API documentation](https://github.com/serverless/event-gateway/blob/master/docs/api.md)
* Get EVENT_GATEWAY_IP from the IP address of event-gateway Kubernetes service.
* Create an event type called aquaEvent:
`curl --request POST --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/eventtypes --header 'content-type: application/json' --data '{"name": "aquaEvent"}'`
* Register the receiver function which runs on the local machine
`curl --request POST --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/functions --header 'content-type: application/json' --data '{"functionId": "receiver", "type": "http", "provider":{"url":"http://172.28.128.3:8080"}}'`
* Subscribe the function to the event
`curl --request POST --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/subscriptions --header 'content-type: application/json' --data '{"functionId": "receiver", "event": "http", "type":"async", "eventType": "aquaEvent", "path": "/hello", "method": "POST"}'`
* Get event types
`curl --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/eventtypes | jq`
* Get subscriptions
`curl --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/subscriptions | jq`
* Get functions
`curl --url http://$EVENT_GATEWAY_IP:4001/v1/spaces/default/functions | jq`