IAmFrench / EFREI-M2-ST2CCO-Spring-Integration

ST2CCO - Advanced Cloud Computing - Spring Integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EFREI-M2-ST2CCO-Spring-Integration

ST2CCO - Advanced Cloud Computing - Spring Integration

Application Diagram

Application Diagram

Application Description

This application takes place for the final project of the course ST2CCO. We have choose to read some files (actors.csv and movies.csv) then load them into Java objects and finally convert them into JSON string and save it into jsons files.

This application demonstrate our knowledge about the Spring pattern.

Installation

You can import the project using IntelliJ IDEA software (File -> Open and select the project folder).

Run

Using IntelliJ IDEA, you can run the project using the Run menu (or press Alt+Maj+F10)

Spring patterns used in this project

Explainations

This Spring application will load the Schema-based configuration: movieApplication.xml. This file will define the overall "pipeline" to use for the application messages flow.

We have iterate from a single actor flow to two flows (actors and movies) and finally we have wrapped all of that inside a single Spring Application.

Below is explained the iterative work for each flow.

Actors flow

Actors Diagram

We have first develop a flow for the actors.csv file, that include a custom transformer (used to create an Actor object).

Actors Transformer

Movies flow

Movies Diagram

After developing the actors flow, we have copied it for the movie input files. And we have made some ajustment :

Movies Transformer

Final Application flow

We have previously see that we use 2 flows that can be run side-by-side. Whit that in mind we can implement a router for each flow. As we know, Actors and Movies flow are almost identical :

  • The inbound-channel-adapter must be adapted to parse both actors.csv and movies.csv, we have done that by using a wildcard on the source file name parameter: *.csv
  • A specific transformer must be used for each message type: if the message is from the actors.csv we must use the Actors Transformer or if the message if from the movies.csv file we must use the Movies Transformer. After searching the Spring documentation, we have fount that a router is able to do this job. As we know the source filename is save in each message header, we have implemented a header-value-router to route each message to the corresponding Transformer.

Tips & project notes

In order to parse the file *.csv into a Java CSV object we have used the opencsv helper.

In order to minimize the application code, we have used the lombok.

About

ST2CCO - Advanced Cloud Computing - Spring Integration


Languages

Language:Java 68.2%Language:Dockerfile 31.8%