Skip to content

RSS/Atom feeds update tracker Rest API service project for Spring Boot

License

Notifications You must be signed in to change notification settings

hhovhann/rss-tracker-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software Document

RSS/Atom feeds update tracker Rest API service project for Spring Boot

Software Environment

  • Java 21
  • MySQL database
  • Flyway migration
  • Spring Boot 3.2.5
  • Maven 3.9.5
  • Jmeter
  • The Room Java Library 2.1.0

Software Structure

  • feature_name(feed)
    • controller
    • dto
    • entity
    • exception
    • mapper
    • repository
    • service

Software Behaviour

System designed as a Spring Boot Web Application. Provides Rest API with following endpoints:

  1. Get list of stored resources faceted by given resources
POST http://localhost:8080/tracker/api/v1/feeds/search-by-resources

REQUEST BODY:
{
    "resources" : ["NYT", "BBC", "WSJ", "FT"],
    "limit": 5
}
    
RESPONSE BODY:
[
    {
        "title": "Crowds for Raisi Show Support for Iranian State, Supreme Leader Says",
        "link": "https://www.nytimes.com/2024/05/25/world/middleeast/iran-khamenei-raisi-crowds.html",
        "resource": "NYT",
        "description": "Ayatollah Ali Khamenei pointed to the turnout at memorials for Iran’s president at a time when external critics say popular backing for the Islamic Republic has weakened.",
        "getPublicationDate": "2024-05-25T12:39:42Z",
        "author": "Erika Solomon",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "Khamenei, Ali",
            "Funerals and Memorials",
            "Raisi, Ebrahim",
            "Iran",
            "Politics and Government"
        ],
        "relatedIdentifiers": []
    },
    {
        "title": "Ukraine Steps Up Attacks With U.S. Long-Range Missiles",
        "link": "https://www.nytimes.com/2024/05/25/world/europe/ukraine-russia-long-range-missiles.html",
        "resource": "NYT",
        "description": "The assaults have hit military targets in Russian-occupied territory in Ukraine. Pressure is now mounting on Washington to let Kyiv fire the missiles into Russia itself.",
        "getPublicationDate": "2024-05-25T11:57:05Z",
        "author": "Constant Méheut",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "Russian Invasion of Ukraine (2022)",
            "Defense and Military Forces",
            "Missiles and Missile Defense Systems",
            "Crimea (Ukraine)",
            "Russia",
            "Ukraine"
        ],
        "relatedIdentifiers": []
    },
    {
        "title": "Man charged with terrorism offences after Syria trip",
        "link": "https://www.bbc.com/news/articles/cnkkz97l8gyo",
        "resource": "BBC",
        "description": "A 31-year-old man who allegedly went to fight for the \"Jaysh Al Fath\" groups is due in court later.",
        "getPublicationDate": "2024-05-25T09:46:37Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [],
        "relatedIdentifiers": []
    },
    {
        "title": "D-Day veteran shares stories with primary children",
        "link": "https://www.bbc.com/news/videos/c722817k4yno",
        "resource": "BBC",
        "description": "Ken Hay, 98, affectionately known as 'Grandad Ken' has been telling east London pupils about D-Day.",
        "getPublicationDate": "2024-05-25T07:11:39Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [],
        "relatedIdentifiers": []
    },
    {
        "title": "The Massive Immigration Wave Hitting America's Classrooms",
        "link": "https://www.wsj.com/articles/the-massive-immigration-wave-hitting-americas-classrooms-3c7d7943",
        "resource": "WSJ",
        "description": "In Stoughton, Mass., more students are arriving. And many come with traumatic pasts and little English.",
        "getPublicationDate": "2024-05-25T13:00:00Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "PAID"
        ],
        "relatedIdentifiers": []
    },
    {
        "title": "With $14 Billion U.S. Steel Deal in Limbo, Nippon Steel Seeks Community Support",
        "link": "https://www.wsj.com/articles/with-14-billion-u-s-steel-deal-in-limbo-nippon-steel-seeks-community-support-76abc6fb",
        "resource": "WSJ",
        "description": "The Japanese steelmaker’s vice chairman, visiting the Pittsburgh area, says the company is ready to “share all the fruits of our technology.”",
        "getPublicationDate": "2024-05-25T12:00:00Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "PAID"
        ],
        "relatedIdentifiers": []
    },
    {
        "title": "Technology for slashing nuclear power plant waste wins Swiss backing",
        "link": "https://www.ft.com/content/286490fd-9181-4c94-8444-a5a19621bbe6",
        "resource": "FT",
        "description": "‘Nuclear transmutation’ could cut highly radioactive waste by 80%, says national body",
        "getPublicationDate": "2024-05-25T12:00:51Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [],
        "relatedIdentifiers": []
    },
    {
        "title": "Women’s football boss Michele Kang: ‘I want the next generation to compete on an equal playing field’",
        "link": "https://www.ft.com/content/b7bb32ea-44ef-49cb-bf72-b78f6cffb1be",
        "resource": "FT",
        "description": "Owner of teams including Olympique Lyon Féminin wants to bring better resources to the female game ",
        "getPublicationDate": "2024-05-25T12:00:51Z",
        "author": "",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [],
        "relatedIdentifiers": []
    }
]
  1. Get list of stored resources faceted by given categories and date range
POST http://localhost:8080/tracker/api/v1/feeds/search

REQUEST BODY:
{
    "categories" : ["Elections"],
    "dateFrom" : "2010-04-27T04:30:45.123Z",
    "dateTo" : "2024-05-23T22:30:45.123Z",
    "limit": 2
}
    
RESPONSE BODY:
[
    {
        "title": "Stage Collapses at Campaign Rally in Mexico, Killing at Least 9",
        "link": "https://www.nytimes.com/2024/05/23/world/americas/mexico-candidate-stage-collapse.html",
        "resource": "NYT",
        "description": "Strong wind caused the collapse in northern Mexico as a presidential hopeful campaigned for a local candidate, officials said. Dozens of people were injured.",
        "getPublicationDate": "2024-05-23T12:49:37Z",
        "author": "Emiliano Rodríguez Mega and John Yoon",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "Mexico",
            "Accidents and Safety",
            "Politics and Government",
            "San Pedro Garza Garcia (Mexico)",
            "Elections",
            "Monterrey (Mexico)",
            "Alvarez Maynez, Jorge",
            "Deaths (Fatalities)"
        ],
        "relatedIdentifiers": []
    },
    {
        "title": "Nigel Farage to Skip U.K. Election So He Can Focus on Helping Trump",
        "link": "https://www.nytimes.com/2024/05/23/world/europe/nigel-farage-donald-trump-uk-election.html",
        "resource": "NYT",
        "description": "The populist British politician, a driving force behind Brexit, said he would not run in the July general election, citing the global importance of the American campaign.",
        "getPublicationDate": "2024-05-23T12:07:47Z",
        "author": "Mark Landler",
        "thumbnails": "entry.getSource().getImage().getUrl()",
        "categories": [
            "Great Britain Withdrawal from EU (Brexit)",
            "Presidential Election of 2024",
            "Elections",
            "Conservative Party (Great Britain)",
            "Farage, Nigel (1964- )",
            "Trump, Donald J",
            "England",
            "Great Britain"
        ],
        "relatedIdentifiers": []
    }
]

Software Setup and Run: Docker containers

  • Create .env file from the root project with
      MYSQL_DATABASE=rss-tracker-docker-db
      MYSQL_USER=api-user
      MYSQL_PASSWORD=api-password
      MYSQL_ROOT_PASSWORD=api-password
      MYSQL_LOCAL_PORT=13306
      MYSQL_DOCKER_PORT=3306
      SPRING_APP_LOCAL_PORT=8888
      SPRING_APP_DOCKER_PORT=8080
    
  • From root directory start containers with docker-compose up
  • To stop the containers run docker compose down

Software Setup and Run: Local Application

  • Download and install Docker Desktop if you not have it installed in your machine
  • Depends on which database we are going to use, should run:
    • local MySql docker run -p 3306:3306 --name rss-tracker-dev-db -e MYSQL_DATABASE=rss-tracker-dev-db -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=api-user -e MYSQL_PASSWORD=api-password -d mysql:latest
  • Run application with bach command from project root ./scripts/run.sh
  • Run the application from the IDEA itself

Software testing with custom data initialization

  • Run seed/feed_configuration_data.sql to fill feed configuration table to see scheduler job process

Software Design and Diagram

Please check the Rss Tracker Service Design

About

RSS/Atom feeds update tracker Rest API service project for Spring Boot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages