-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
36 lines (26 loc) · 877 Bytes
/
main.cpp
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
32
33
34
35
36
#include <list>
#include <iostream>
#include "src/KafkaConsumer.h"
#include "src/crawlers/FacebookCrawler.h"
#include "src/crawlers/GoogleCrawler.h"
#include "src/crawlers/TradeRegisterCrawler.h"
int main (int argc, char **argv)
{
// simulate Kafka topic with few messages
std::list<std::string> dummyTopic = {
"req-1",
"req-2",
"req-3"
};
// ---
// setup observers/subscribers (Crawlers) and producer (KafkaConsumer - produces tasks for crawlers)
FacebookCrawler fc;
GoogleCrawler gc;
TradeRegisterCrawler trc;
KafkaConsumer kafkaConsumer;
kafkaConsumer.registerSubscriber(&fc);
kafkaConsumer.registerSubscriber(&gc);
kafkaConsumer.registerSubscriber(&trc);
kafkaConsumer.consumeTopic(dummyTopic); // simulate consuming topic
return 0;
}