Spring Boot REST API for telecom user, account, and subscription management with Eureka registration, Resilience4j fault tolerance, Feign-based downstream calls, and an explicit subscription lifecycle.
This project manages telecom customer data in a single Spring Boot service. Version 5 keeps the existing user and account flows, but turns subscriptions into a lifecycle-driven workflow. Subscription creation now starts in REQUESTED, billing success promotes the subscription to ACTIVE, and the service exposes explicit transitions for suspend, cancel, and payment failure handling.
The project is useful for understanding lifecycle-based APIs, JPA relationships, DTO mapping, service discovery, declarative service-to-service communication, and resilience patterns for downstream failures.
- Spring Boot REST APIs
- Spring Data JPA entities and repositories
- One-to-one and one-to-many mapping
- DTO-based request handling
- User, account, and subscription CRUD
- Eureka client registration
- Resilience4j circuit breaker, retry, timeout, and fallback support
- OpenFeign clients for billing and support calls
- Subscription lifecycle states:
REQUESTED,ACTIVE,SUSPENDED,CANCELLED,PAYMENT_FAILED - Subscription creation with downstream invoice creation
- Billing-aware activation and payment failure handling
- Ticket retrieval from support-service
- JSON serialization control with
@JsonIgnoreProperties
- Java 17
- Spring Boot 2.7.13
- Spring Web
- Spring Data JPA
- Spring Cloud Netflix Eureka Client
- Spring AOP
- Resilience4j Spring Boot 2
- Spring Cloud OpenFeign
- MySQL
- Lombok
- Maven
GET /api/userGET /api/user/{id}GET /api/user/name/{name}GET /api/user/email/{email}GET /api/user/tickets/{userId}POST /api/userPUT /api/user/{id}DELETE /api/user/{id}
GET /accountGET /account/{id}GET /account/userId/{userId}POST /accountPUT /account/{id}DELETE /account/{id}
GET /api/subscriptionGET /api/subscription/{id}GET /api/subscription/userId/{userId}POST /api/subscriptionPOST /api/subscription/{id}/activatePOST /api/subscription/{id}/suspendPOST /api/subscription/{id}/cancelPOST /api/subscription/{id}/payment-failedDELETE /api/subscription/{id}
curl -X POST http://localhost:8080/api/user \
-H "Content-Type: application/json" \
-d '{
"name": "Asha Patel",
"email": "asha@example.com",
"contact": 9876543210,
"address": "Mumbai"
}'Expected response:
{
"message": "User created Successfully"
}curl -X POST http://localhost:8080/api/subscription \
-H "Content-Type: application/json" \
-d '{
"userId": 1,
"price": 499,
"planName": "Silver Plan",
"planDetails": "Monthly calling and data pack"
}'Expected response:
{
"message": "Subscription created with status ACTIVE"
}curl -X POST http://localhost:8080/api/subscription/1/suspend
curl -X POST http://localhost:8080/api/subscription/1/activate
curl -X POST http://localhost:8080/api/subscription/1/cancelcurl http://localhost:8080/api/user/tickets/1Sample response:
[][
{
"id": 1,
"name": "Asha Patel",
"email": "asha@example.com",
"contact": 9876543210,
"address": "Mumbai"
}
][
{
"id": 1,
"price": 499,
"planName": "Silver Plan",
"planDetails": "Monthly calling and data pack"
}
]- Start your Eureka server on
http://localhost:8761. - Make sure the downstream billing and support services are available if you want the Feign calls to succeed.
- Provide MySQL datasource settings in your local environment or profile, since this snapshot keeps discovery and resilience settings in
application.yml. - Start the application with Maven or from your IDE.
- Call the endpoints on port
8080.
Example:
mvn spring-boot:runSubscriptionService/
├── src/main/java/Telecom/SubscriptionService/
│ ├── controller/
│ ├── dto/
│ ├── feign/
│ ├── model/
│ ├── repository/
│ ├── service/
│ ├── BillingDtos/
│ ├── SupportDtos/
│ └── SubscriptionServiceApplication.java
├── src/main/resources/application.yml
├── README.md
├── CHANGELOG.md
└── .gitignore
flowchart LR
Client[Client] --> UserAPI["/api/user"]
Client --> AccountAPI["/account"]
Client --> SubAPI["/api/subscription"]
Eureka["Eureka Server :8761"] --- App["SubscriptionService :8080"]
App --> UserService["UserService"]
App --> AccountService["AccountService"]
App --> SubService["SubscriptionService"]
SubService --> Requested["REQUESTED"]
Requested --> BillingClient["billing-service Feign client"]
BillingClient --> Active["ACTIVE"]
BillingClient --> PaymentFailed["PAYMENT_FAILED"]
Active --> Suspended["SUSPENDED"]
Suspended --> Active
Active --> Cancelled["CANCELLED"]
Requested --> Cancelled
PaymentFailed --> Active
UserService --> Resilience["Resilience4j circuit breaker + retry + timeout"]
Resilience --> SupportClient["support-service Feign client"]
UserAPI --> Tickets["/api/user/tickets/{userId}"]
Tickets --> SupportClient
- Using Eureka client registration in a Spring Boot app
- Using Feign clients for downstream billing and support calls
- Adding separate downstream calls for billing and support
- Turning subscriptions into a lifecycle-driven workflow instead of plain CRUD
- Managing billing-aware state transitions for subscriptions
- Replacing Hystrix with Resilience4j circuit breaker, retry, timeout, and fallback handling
- Managing JPA relationships while exposing DTO-friendly REST APIs
- The application keeps
application.ymlfocused on discovery and resilience settings. - Local datasource settings are expected to be supplied outside this file.
- IDE files and build artifacts are intentionally excluded from version control.