/BNBcurrency

Websocket application for getting the world currencies

Primary LanguageJava

BNB currency

Microservice application to get all world currencies and make a connection between client and server websocket.

Project summary linkedin

Microservice with REST endpoint – “/download-currencies”. This endpoint can be hit numerous times everyday. When the endpoint being hit, we need to get the lastest information about all currencies from BNB in xml format. The data need to be saved in PostgreSql table and to send this information through websocket in JSON format so, this to happen we need this to be also websocket server. The currencies need to be saved with the bulgarian and english names. We need to create second service which reads the data and write it into another db table.

Usage

First we start the main spring method - CurrencyServiceApplication.
Screenshot 2024-03-21 at 15 35 17
Go to postman and we can see the data in json format which we get it from a file from resources package.
Screenshot 2024-03-21 at 15 36 36
After that we start the BnbServer. Which will create our server - BnbServerEndopint. ServerEndPoint is a class-level annotation that declares that the class it decorates is a WebSocket endpoint deployed and made available in a WebSocket server.
Screenshot 2024-03-21 at 15 35 34
We start our BnbClientEndpoint and we type yes the BnbServerEndopint will create a post request to – http://localhost:8080/add-currencies which will be handled by controller. If we want to get the info about currencies. Any other key will close the connection.
Screenshot 2024-03-21 at 15 35 39
Then we go to see the database and the data in it. First for Currency.
Screenshot 2024-03-21 at 15 36 22
And after that for CurrencyFromServer.
Screenshot 2024-03-21 at 15 36 26

Public part

The application's public part represents endpoint to see all world currencies in json format: /download-currencies.

Error handling of ids

When we write the new currencies in the tables, firstly we delete the old ones and after that we rewrite the data with reset id starting again from 1.

Languages and tools

linkedin linkedin linkedin


Statistics

Valentin's GitHub stats


Most Used Languages

Connect with me

linkedin