Demo rules: https://github.com/ac360/cloudevents-demo
All you need is to put Twitter account credentials to app file. Follow the instructions at https://developer.twitter.com/en/docs/basics/getting-started#get-started-app
fn -v deploy --all --registry `whoaim`
Using the following command you can test the application:
curl -v -X POST ${FN_API_URL}/r/cloudevents/cloudevent -d @tweet-entry/payloads/aws.payload.json
A function that does image processing has a config var: DETECT_SENSITIVITY
,
it has default value - "0.3"
, it’s enough to detect most of the objects.
However, as lower you go then more objects detected but probability of the correct detection may vary from 0 to 100.
So if you want to get more objects detected, just set that to "0.1"
CloudEvent function accepts the following payloads:
Image processing function accepts the following payload:
# creates an application
fn apps create cloudevents
# sets application config
fn apps config set cloudevents TWITTER_CONSUMER_KEY ...
fn apps config set cloudevents TWITTER_CONSUMER_SECRET ...
fn apps config set cloudevents TWITTER_ACCESS_TOKEN_KEY ...
fn apps config set cloudevents TWITTER_ACCESS_TOKEN_SECRET ...
fn routes create cloudevents /cloudevent --image denismakogon/tweet-entry:0.0.1 --type async --format json --timeout 60 --idle-timeout 30
fn routes create cloudevents /image-processor --image denismakogon/image-processor:0.0.1 --type async --format json --timeout 3600 --idle-timeout 120 --memory 1024
fn routes config set cloudevents /image-processor DETECT_SENSITIVITY "0.3"