Skip to content

guillecanovas/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
Fernando Serrano 774840 Build Status Solution Rest EndPoint 🎁
José Marín 778148 Build Status Solution
Mateo Vallejo 780029 Build Status Solution
Diego García Muro 767870 Build Status Solution
Pablo Jordán 757166 Build Status Solution
Sergio Benítez Mombiela 755787 Build Status Solution
Isaac Velasco 758986 Build Status Solution
Héctor Bara 779354 Build Status Solution
Rubén Subías 759406 Build Status Solution
Germán Garcés 757024 Build Status Solution
Alvaro Echavarri 737400 Build Status Solution
Marta Morales Sabroso 780454 Build Status Solution
Binhui Chen Zhou 779799 Build Status Solution
Jorge Serrano 776453 Build Status Solution
Guillermo Cánovas 755848 Build Status Solution