-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.go
31 lines (29 loc) · 851 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"github.com/kryptx/tweetstorm/config"
"github.com/kryptx/tweetstorm/db"
"github.com/kryptx/tweetstorm/twitter"
"github.com/kryptx/tweetstorm/web"
writers "github.com/kryptx/tweetstorm/writers"
)
func main() {
c := config.Load("config.yml")
mongoCollection := db.GetMongoCollection(c.Mongo)
elasticClient := db.GetElasticClient(c.ElasticSearch)
indexer := &writers.TweetJSONIndexer{
Factory: &writers.ElasticsearchJSONIndexerFactory{
Client: elasticClient,
IndexName: c.ElasticSearch.Index,
},
}
tweetWriters := []twitter.TweetWriter{
&writers.MongoTweetWriter{Collection: mongoCollection},
&writers.IndexTweetWriter{Indexer: indexer},
}
go web.HandleRequests(mongoCollection, elasticClient)
twitter.StreamTweets(
c.Twitter.FilterTerms,
twitter.GetClient(c.Twitter.Auth),
tweetWriters,
)
}