Web Engineering 2021-2022 / SOA
In this assignment your PR must only modify the README.md
file. Please, go to the Wiki in order to get the instructions for this assignment.
Apache Camel
Camel is an Open Source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data. This is a common SOA scenario. The snippet below:
- Search tweets in Twitter and returns to the web client
- Dump to disk at least one of tweets retrieved encoded in JSON in the folder
log/{year}/{month}/{day}
- Compute metrics (available at
/actuator/metrics/per-keyword-messages?tag=keyword:${value}
, values available athttp://localhost:8080/actuator/metrics/per-keyword-messages
)
from(DIRECT_ROUTE)
.toD("twitter-search:\${header.keywords}") // Twitter search, returns a list of Tweets
.wireTap(LOG_ROUTE) // Copy the list of tweets to the LOG_ROUTE, which is processed by its own thread
.wireTap(COUNT_ROUTE) // Copy the list of tweets to the COUNT_ROUTE, which is processed by its own thread
// returns a list of tweets to the DIRECT_ROUTE caller
from(LOG_ROUTE)
.marshal().json(JsonLibrary.Gson) // Encode the list of tweets as JSON
.to("file://log?fileName=\${date:now:yyyy/MM/dd/HH-mm-ss.SSS}.json") // Write the JSON to a file
from(COUNT_ROUTE)
.split(body()) // Split the list in single Tweets
.process { exchange -> // Process a single Tweet
val keyword = exchange.getIn().getHeader("keywords")
if (keyword is String) {
keyword.split(" ").map {
perKeywordMessages.increment(it)
}
}
}
Primary goal
The objective is to extend the query interface to support the command max:n
, where n is a number. max
sets a limit in the number of retrieved tweets. That is cool max:10
must return at most 10 tweets. There are several ways to do it. You can use the parameter q
or create additional parameters. There is a restriction. You must explicitly tell the API Twitter to enforce such a limit. Read the documentation of the Twitter Search component of Apache Camel to discover how.
You need to apply for a free Twitter developer account.
Do not add application.properties
with the Twitter tokens to your git!
Note: the Twitter Search endpoint is configured using URI syntax twitter-search:{string}[?param=value[¶m=value]*]
🎁
)
Secondary goals (Proposed:
- Use Camel for providing a REST endpoint for queries; current client should work.
- Use Camel for providing a WebSocked endpoint for queries; a websocket client is required.
- Use Camel for keeping a copy of responses in a database
- Enrich the response with moustache; remove moustache from the client.
- Create an operator "-" to filter out tweets that contain a keyword
- Throttle the route to avoid be banned by Twitter
The link provides one of the possible approaches. You can use a different one.
The possibilities of Camel are endless; you can propose your idea for a
Manifest your intention first by a PR updating this README.md
with your goal. If you desist of your goal, release it by a PR so other fellow can try it.
User name | NIA | Status | Improvement | Score |
---|---|---|---|---|
UNIZAR-30246-WebEngineering | 30246 | instructions | ||