twitter-search-dapr-component-example

command module
v0.0.0-...-bb0fcd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

twitter-search-dapr-component-example

Example of how to use Twitter search input component in godapr.

Prerequisites

dapr

To run this demo locally, you will have to have install dapr. The instructions for how to do that can be found here.

Twitter

To configure the dapr input component to query Twitter API you will also need the consumer key and secret. You can get these by registering a Twitter application here.

Setup

Assuming you have all the prerequisites mentioned above you can demo this dapr pipeline in following steps. First, start by cloning this repo:

git clone https://github.com/mchmarny/twitter-search-dapr-component-example.git

and then navigate into the twitter-search-dapr-component-example directory:

cd twitter-search-dapr-component-example
Component

Insert your Twitter API secrets into the components/twitter.yaml file.

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: tweets
spec:
  type: bindings.twitter
  metadata:
  - name: consumerKey
    value: ""
  - name: consumerSecret
    value: ""
  - name: accessToken
    value: ""
  - name: accessSecret
    value: ""
  - name: query
    value: "serverless"

The query is the twitter search query for which you want to receive tweets.

Run

Once the Twitter API consumer and access details are set, you are ready to run:

dapr run go run handler.go main.go \
         --app-id "consumer" \
         --app-port 8081 \
         --protocol http \
         --port 3500

Assuming everything went OK, you should see something like this:

ℹ️  Updating metadata for app command: handler.go main.go
✅  You're up and running! Both Dapr and your app logs will appear here.

Hope you found this demo helpful.

Disclaimer

This is my personal project and it does not represent my employer. I take no responsibility for issues caused by this code. I do my best to ensure that everything works, but if something goes wrong, my apologies is all you will get.

License

This software is released under the Apache v2 License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL