Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17
FROM eclipse-temurin:24
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
18 changes: 17 additions & 1 deletion api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,27 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class ApiGateway {
public static void main(String[] args) {
SpringApplication.run(ApiGateway.class, args);
Expand Down
2 changes: 1 addition & 1 deletion discovery-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17
FROM eclipse-temurin:24
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
13 changes: 13 additions & 0 deletions discovery-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
12 changes: 3 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
version: '3'
services:

### Services ###
discovery-server:
image: 'aenesgur/ms-ex/discovery-server-image'
container_name: discovery-server
build:
context: ./discovery-server/
ports:
- "8761:8761"

api-gateway:
image: 'aenesgur/ms-ex/api-gateway-image'
container_name: api-gateway
build:
context: ./api-gateway/
Expand All @@ -26,7 +23,6 @@ services:

product-service:
container_name: product-service
image: 'aenesgur/ms-ex/product-service-image'
build:
context: ./product-service/
ports:
Expand All @@ -46,7 +42,6 @@ services:
- kafka

order-service:
image: 'aenesgur/ms-ex/order-service-image'
container_name: order-service
build:
context: ./order-service/
Expand All @@ -68,7 +63,6 @@ services:
- kafka

product-stock-service:
image: 'aenesgur/ms-ex/product-stock-service'
container_name: product-stock-service
build:
context: ./product-stock-service/
Expand All @@ -89,7 +83,6 @@ services:
- kafka

send-sms-service:
image: 'aenesgur/ms-ex/send-sms-service'
container_name: send-sms-service
build:
context: ./send-sms-service/
Expand All @@ -108,7 +101,7 @@ services:
### Dependencies ###
postgres-productservice:
container_name: postgres-productservice
image: postgres
image: postgres:16
environment:
POSTGRES_DB: product-service
POSTGRES_USER: productservice-user
Expand All @@ -125,7 +118,7 @@ services:

mysql-orderservice:
container_name: mysql-orderservice
image: mysql
image: mysql:8
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=123456
Expand All @@ -148,6 +141,7 @@ services:

kafka:
image: obsidiandynamics/kafka
platform: linux/amd64
container_name: kafka
restart: "no"
ports:
Expand Down
4 changes: 4 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.anyConstructor.addConstructorProperties = true
lombok.builder.className = Builder
2 changes: 1 addition & 1 deletion order-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17
FROM eclipse-temurin:24
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
25 changes: 23 additions & 2 deletions order-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand All @@ -49,6 +49,27 @@
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class OrderService {
public static void main(String[] args) {
SpringApplication.run(OrderService.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public ResponseEntity<String> createOrder(@RequestBody OrderDto orderDto) {
return new ResponseEntity("Order created succesfully.", HttpStatus.CREATED);
}

public ResponseEntity<String> productStockFallbackMethod(OrderDto orderDto, RuntimeException exception){
return new ResponseEntity<>("Something went wrong for this operation. Please try later...", HttpStatus.SERVICE_UNAVAILABLE);
public ResponseEntity<String> productStockFallbackMethod(OrderDto orderDto, RuntimeException exception) {
return new ResponseEntity<>("Something went wrong for this operation. Please try later...",
HttpStatus.SERVICE_UNAVAILABLE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.*;

import javax.persistence.*;
import jakarta.persistence.*;
import java.util.List;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.*;

import javax.persistence.*;
import jakarta.persistence.*;
import java.math.BigDecimal;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

import javax.transaction.Transactional;
import jakarta.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand Down
21 changes: 19 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<version>3.2.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.aenesgur.microservice</groupId>
Expand All @@ -25,7 +25,8 @@
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<spring-cloud.version>2021.0.2</spring-cloud.version>
<spring-cloud.version>2023.0.0</spring-cloud.version>
<lombok.version>1.18.30</lombok.version>
</properties>
<dependencies>
<dependency>
Expand All @@ -36,6 +37,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -70,6 +72,21 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
2 changes: 1 addition & 1 deletion product-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17
FROM eclipse-temurin:24
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
19 changes: 16 additions & 3 deletions product-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down Expand Up @@ -48,6 +47,22 @@
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>

<build>
Expand All @@ -66,6 +81,4 @@
</plugin>
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class ProductService {
public static void main(String[] args) {
SpringApplication.run(ProductService.class, args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.aenesgur.productservice.event;

import com.aenesgur.productservice.model.dto.ProductEventModel;
import com.aenesgur.productservice.model.dto.ProductRequestDto;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.math.BigDecimal;

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.*;

import javax.persistence.*;
import jakarta.persistence.*;
import java.math.BigDecimal;

@Entity
Expand Down
Loading