Skip to content

Latest commit

 

History

History
 
 

sink

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Knative Redis Sink

Redis Event Sink for Knative

Prerequisites

  • Knative Serving

Getting started

Install the sink:

ko apply -f sink/config

Example

In this example, you create one Redis Stream sink for adding items into the mystream stream.

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/sink

Verify the sink is ready:

kubectl get -n redex redisstreamsink.sinks.knative.dev mystream
NAME       URL                                                     AGE   READY   REASON
mystream   http://redistreamsinkmystream.redex.svc.cluster.local   35s   True

Send an event to the sink:

curl $(kubectl get ksvc redistreamsinkmystream -ojsonpath='{.status.url}') \
 -H "ce-specversion: 1.0" \
 -H "ce-type: dev.knative.sources.redisstream" \
 -H "ce-source: cli" \
 -H "ce-id: 1" \
 -H "datacontenttype: application/json" \
 -d '["fruit", "orange"]'

Check a new message has been added to redis:

kubectl exec -n redis svc/redis redis-cli xinfo stream mystream
...
last-entry
1598652372717-0
fruit
orange

To cleanup, delete the redex namespace:

kubectl delete ns redex