Skip to content

johan14/exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exchange

This is an currency exchange application which utilizes external web services for currency conversions.

Table of Contents

Intro

This is a Spring Boot application which serves HTTP requests in order to convert between currencies at latest rates. The application utilizes multiple exchange rates providers.

Installation

Running these commands:

mvn clean install

java -jar target/exchange-0.0.1-SNAPSHOT.jar

Usage

After running the application, you can hit localhost:8081/api/v1/convert endpoint with a POST request, which body is as below:

{
"from" : string ("EUR", "USD", etc) ,
"to" : string ("EUR", "USD", etc) ,
"amount" : number 
}

Features

By validating inputs such as currency names and amount, /convert endpoint returns the amount calculated by rates which are stored in a Caffeine cache. If one of the providers API is down for any reason, a circuit breaker is used for falling back into another provider API.

For every request, there is an async update of the cache in case the cache is empty, and also there is a scheduled job in place which updates the cache once in a while.

Structure

Sequence diagram:

image

API Documentation

This application uses Swagger for API documentation. In this case there is only one endpoint:

image

Testing Coverage

There is a 92% testing coverage using Mockito and JUnit libraries for mocking and asserting.

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages