{"id":18048053,"url":"https://github.com/ivangfr/spring-integration-examples","last_synced_at":"2025-04-10T09:47:13.399Z","repository":{"id":111328550,"uuid":"200516104","full_name":"ivangfr/spring-integration-examples","owner":"ivangfr","description":"The goal of this project is to learn String Integration Framework For it, we will implement some Spring Boot applications and try to use the well known Enterprise Integration Patterns.","archived":false,"fork":false,"pushed_at":"2025-04-06T11:13:44.000Z","size":3575,"stargazers_count":4,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T12:23:53.301Z","etag":null,"topics":["docker","enterprise-integration-patterns","java","mongodb","spring-boot","spring-data-mongodb","spring-integration","spring-integration-file","spring-shell","spring-web-mvc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivangfr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ivangfr"}},"created_at":"2019-08-04T16:28:22.000Z","updated_at":"2025-04-06T11:13:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf42ac84-4c56-4fc3-9282-91c5828d3f62","html_url":"https://github.com/ivangfr/spring-integration-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-integration-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-integration-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-integration-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspring-integration-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivangfr","download_url":"https://codeload.github.com/ivangfr/spring-integration-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248196709,"owners_count":21063490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","enterprise-integration-patterns","java","mongodb","spring-boot","spring-data-mongodb","spring-integration","spring-integration-file","spring-shell","spring-web-mvc"],"created_at":"2024-10-30T20:11:06.655Z","updated_at":"2025-04-10T09:47:13.387Z","avatar_url":"https://github.com/ivangfr.png","language":"Java","readme":"# spring-integration-examples\n\nThe goal of this project is to learn [`Spring Integration`](https://docs.spring.io/spring-integration/reference/). For it, we will implement some [`Spring Boot`](https://docs.spring.io/spring-boot/index.html) applications and try to use the well-known [`Enterprise Integration Patterns`](https://www.enterpriseintegrationpatterns.com/patterns/messaging/toc.html). \n\n## Proof-of-Concepts \u0026 Articles\n\nOn [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.\n\n## Project Architecture\n\n![project-diagram](documentation/project-diagram.png)\n\n## Applications\n\n- ### calculator-api\n\n  `Spring Boot` Java Web application that exposes an endpoint so that users can submit the operation (addition, subtraction, division or multiplication) they want to perform over two decimal numbers `a` and `b`.\n  \n  ```text\n  POST /api/calculate -d { \"a\": number, \"b\": number, \"operation\": [\"ADD\" | \"SUBTRACT\" | \"DIVIDE\" | \"MULTIPLY\"] }\n  ```\n  \n- ### file-service\n\n  `Spring Boot` Java Web application that exposes an endpoint so that users can get information about a file. This service keeps looking at `shared/files` folder for created or modified files and save their content and info in [`MongoDB`](https://www.mongodb.com/).\n  \n  ```text\n  GET api/files/{filename}\n  ```\n\n- ### spring-integration-shell\n\n  `Spring Boot Shell` Java application that has a couple of commands. One is to write some content to a file. Those files are stored in `shared/files` folder. Besides, there are some commands that uses `calculator-api` to compute the basic Math operations. There is also has a command that calls `file-service` in order to get information about a file. All the communication with `calculator-api` and `file-service` is over `HTTP`. Finally, there is a simple command called `greet`, so that you can display a greeting message on the screen depending on the time of the day.\n\n## Prerequisites\n\n- [`Java 21`](https://www.oracle.com/java/technologies/downloads/#java21) or higher;\n- A containerization tool (e.g., [`Docker`](https://www.docker.com), [`Podman`](https://podman.io), etc.)\n\n## Start Environment\n\n- Open a terminal and navigate to the `spring-integration-examples` root folder.\n- Run the following command:\n  ```bash\n  docker compose up -d\n  ```\n\n## Running Applications with Maven\n\n- **calculator-api**\n\n  In a terminal and inside the `spring-integration-examples` root folder run:\n  ```bash\n  ./mvnw clean spring-boot:run --projects calculator-api\n  ```\n\n- **file-service**\n\n  Open a new terminal and inside the `spring-integration-examples` root folder run:\n  ```bash\n  SHARED_FILES_PATH=${PWD}/shared/files ./mvnw clean spring-boot:run --projects file-service\n  ```\n\n- **spring-integration-shell**\n\n  Open a new terminal and inside the `spring-integration-examples` root folder run:\n  ```bash\n  SHARED_FILES_PATH=${PWD}/shared/files ./mvnw clean spring-boot:run --projects spring-integration-shell\n  ```\n\n## Run applications as Docker containers\n\n- ### Build Docker Images\n\n  - In a terminal, make sure you are in the `spring-integration-examples` root folder.\n  - Run the following script to build the Docker images:\n    ```bash\n    ./build-docker-images.sh\n    ```\n\n- ### Environment Variables\n\n  - **calculator-api**\n\n    `None`\n\n  - **file-service**\n\n    | Environment Variable | Description                                                         |\n    |----------------------|---------------------------------------------------------------------|\n    | `MONGODB_HOST`       | Specify host of the `MongoDB` database to use (default `localhost`) |\n    | `MONGODB_PORT`       | Specify port of the `MongoDB` database to use (default `27017`)     |\n\n  - **spring-integration-shell**\n\n    | Environment Variable  | Description                                                       |\n    |-----------------------|-------------------------------------------------------------------|\n    | `CALCULATOR_API_HOST` | Specify host of the `calculator-api` to use (default `localhost`) |\n    | `CALCULATOR_API_PORT` | Specify port of the `calculator-api` to use (default `9080`)      |\n    | `FILE_SERVICE_HOST`   | Specify host of the `file-service` to use (default `localhost`)   |\n    | `FILE_SERVICE_PORT`   | Specify port of the `file-service` to use (default `9081`)        |\n\n- ### Start Docker Containers\n\n  - In a terminal, make sure you are inside the `spring-integration-examples` root folder.\n  - Run following command:\n    ```bash\n    ./start-services.sh \u0026\u0026 ./start-shell.sh\n    ```\n\n## Playing around\n\n- **calculator-api**\n\n  A sample of request to add two numbers:\n  ```bash\n  curl -i -X POST http://localhost:9080/api/calculate \\\n    -H 'Content-Type: application/json' \\\n    -d '{\"operation\": \"ADD\", \"a\": 10, \"b\": 12}'\n  ```\n\n- **spring-integration-shell**\n\n  The `spring-integration-shell` UI and a sample of execution:\n\n  ![spring-integration-shell](documentation/spring-integration-shell.jpeg)\n\n- **file-service**\n\n  A sample of request to get information about a file:\n  ```bash\n  curl -i http://localhost:9081/api/files/file.txt\n  ```\n\n## Useful Commands\n\n- **MongoDB**\n\n  Find all files:\n  ```bash\n  docker exec -it mongodb mongosh filesdb\n  db.myFiles.find()\n  ```\n  \u003e Type `exit` to get out of `MongoDB shell`\n\n## Shutdown\n\n- To stop `spring-integration-shell`, go to the terminal where it is running and type `exit`.\n- To stop `calculator-api` and `file-service`:\n  - If you start them with `Maven`, go to the terminals were they are running and press `Ctrl+C`.\n  - If you start them as Docker containers, go to a terminal and, inside the `spring-integration-examples` root folder, run the following script:\n    ```bash\n    ./stop-services.sh\n    ```\n- To stop and remove `MongoDB` and docker compose network, go to a terminal and, inside the `spring-integration-examples` root folder, run the command below:\n  ```bash\n  docker compose down -v\n  ```\n\n## Cleanup\n\nTo remove the Docker images created by this project, go to a terminal and, inside the `spring-integration-examples` root folder, run the following script:\n```bash\n./remove-docker-images.sh\n```","funding_links":["https://github.com/sponsors/ivangfr"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspring-integration-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivangfr%2Fspring-integration-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspring-integration-examples/lists"}