Redis Event Source for Knative
Install the source:
ko apply -f source/config
In this example, you create one Redis Stream source listening for items added to
the mystream
stream. The items are sent to the event display service as
CloudEvent.
Install Redis by running this command:
kubectl apply -f samples/redis
Create a namespace:
kubectl create ns redex
Install the example by running this command:
kubectl apply -n redex -f samples/source
Verify the source is ready:
kubectl get -n redex redisstreamsources.sources.knative.dev mystream
NAME SINK AGE READY REASON
mystream http://event-display.redex.svc.cluster.local/ 38s True
Add an item to mystream
:
kubectl exec -n redis svc/redis redis-cli xadd mystream '*' fruit banana color yellow
Check the event display received the event:
kubectl logs -n redex svc/event-display
☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 1.0
type: dev.knative.sources.redisstream
source: /mystream
id: 1597775814718-0
time: 2020-08-18T18:36:54.719802342Z
datacontenttype: application/json
Data,
[
"fruit",
"banana"
"color",
"yellow"
]
The data contains the list of field-value pairs added to the stream.
To cleanup, delete the redex namespace:
kubectl delete ns redex
- Consume stream via a consumer group (internal change) (08/24/2020)
- RedisStreamSource can now be deployment in any namespace (08/21/2020)
- The redis address can now be specified in RedisStreamSource (08/21/2020)