https://github.com/manonworldrepository/spring-cloud-stream-cashcard-application
Spring cloud stream application
https://github.com/manonworldrepository/spring-cloud-stream-cashcard-application
graalvm spring spring-cloud-stream spring-cloud-stream-kafka
Last synced: 4 months ago
JSON representation
Spring cloud stream application
- Host: GitHub
- URL: https://github.com/manonworldrepository/spring-cloud-stream-cashcard-application
- Owner: manonworldrepository
- Created: 2024-12-09T02:47:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-01T14:11:29.000Z (over 1 year ago)
- Last Synced: 2025-02-09T06:13:53.686Z (over 1 year ago)
- Topics: graalvm, spring, spring-cloud-stream, spring-cloud-stream-kafka
- Language: Java
- Homepage: https://www.linkedin.com/in/mostafa-abdelhamid-atwa-067a0a26b/
- Size: 148 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cashcard Application [](https://github.com/manonworldrepository/spring-cloud-stream-cashcard-application/actions/workflows/gradle.yml)
This project demonstrates a simple, event-driven system using Spring Cloud Stream, Kafka, and Spring Boot with GraalVM native images. All services are designed to run within a Docker environment.
### Prerequisites
* Java 21+
* Docker and Docker Compose
### Building and Running the System
The entire system, including the applications and the end-to-end tests, is managed through Docker Compose.
If you want to build the application faster, you can just pull the necessary images from docker:
```bash
docker pull paketobuildpacks/builder-jammy-java-tiny:latest
docker pull paketobuildpacks/run-jammy-tiny:latest
```
**1. Build the Application Docker Images**
First, build the native Docker images for the `source`, `enricher` and `sink` services using the Spring Boot Gradle plugin.
```bash
./gradlew clean bootBuildImage --no-daemon
```
Or you can build one image after another like so:
```bash
./gradlew :cashcard-transaction-source:bootBuildImage --no-daemon
./gradlew :cashcard-transaction-enricher:bootBuildImage --no-daemon
./gradlew :cashcard-transaction-sink:bootBuildImage --no-daemon
```
### Then in order to be able to run everything in docker containers, just run the following command:
```bash
docker compose up -d --build
```
### Application's Endpoint URL:
``` http://localhost:8080/pub ```
HTTP Method: ``` POST ```
Example Payload:
```
{
"id": 1234,
"cashCard": {
"id": 12345,
"owner": "testOwner",
"amountRequestedForAuth": "3.14"
}
}
```
You can also check `requests.http` to run the same request.
### Architecture Overview

### Running Tests
` ./gradlew clean test `
### Grafana Dashboard
The system starts with a preconfigured Prometheus datasource and a basic "CashCard System Overview" dashboard.
URL: http://localhost:3000
Username: `admin`
Password: `admin`
A screenshot of Grafana Dashboard should look like so:
