Skip to content

jaimecb/lab5-soa

 
 

Repository files navigation

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 at http://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[&param=value]*]

Secondary goals (:gift:)

Proposed:

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 Build Status instructions
Diego Marco 755232 Build Status Solution
Alejandro Magallón 779354 Build Status Solution
Óscar Pueyo 780378 Build Status Solution
María Peña 780448 Build Status Solution
Tomás Pelayo 779691 Build Status Solution
Jorge Laguna 735550 Build Status Throttle the route to avoid be banned by Twitter 🎁
María Peña 780448 Build Status Solution
Andoni Salcedo 785649 Build Status Solution
Alejandro Artal 775929 Build Status Solution
Jaime Conchello 776012 Build Status Solution

About

Lab5-soa (deadline 2021-12-17)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 52.5%
  • HTML 41.4%
  • JavaScript 6.1%