-
Notifications
You must be signed in to change notification settings - Fork 37
[3주차] 예약 API 구현 및 분산락 적용 #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DongHyunKIM-Hi
merged 42 commits into
hanghae-skillup:zhdiddl
from
zhdiddl:feature/week3
Feb 6, 2025
Merged
Changes from 34 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
e407e9c
refactor: 영화 검색 조건을 DTO로 캡슐화해 확장 가능하도록 개선
zhdiddl d34a68b
refactor: 요청 값에 대한 validation 조건 개선
zhdiddl 82ce364
feat: 인덱스 생성 쿼리를 DDL에 추가
zhdiddl b6c91f5
refactor: 동적 정렬 로직에 순서 유지 및 필드 제한 적용
zhdiddl 2e43f50
chore: 복합 인덱스 적용 후 성능 테스트 결과 README 반영
zhdiddl 7afcc1d
chore: 주석 및 설정 수정으로 가독성 개선
zhdiddl df23690
chore: README 수정
zhdiddl c441a56
feat: 영화 예약 API에 필요한 엔티티 추가
zhdiddl 56b1505
refactor: 좌석 번호 값 객체 리팩토링
zhdiddl 78ec165
feat: 예약 생성 시 검증에 필요한 Validation 추가
zhdiddl 2e50fc0
feat: 저장소 포트 및 어댑터 추가
zhdiddl ad7edce
feat: 예약 생성 요청 및 응답 DTO 추가
zhdiddl 54be6e6
refactor: 예약 생성 Validation 로직 개선
zhdiddl 660f36b
refactor: Validation 포트 및 어댑터 추가로 서비스 간 참고 제거
zhdiddl 4f7ef63
feat: 예약 생성 서비스 포트 및 구현체 추가
zhdiddl 51f364c
fix: 예약 리포지토리 인터페이스 및 어댑터 수정
zhdiddl 90f9eec
style: 코드 포맷팅 수정
zhdiddl 7991a01
feat: 엔티티 추가에 따른 DDL 업데이트
zhdiddl 3d95f66
refactor: 클라이언트 요청 값을 컨트롤러에서 검증하도록 책임 분리
zhdiddl b1d4dfe
fix: CustomException 메시지 처리 로직 수정
zhdiddl 9556ab8
test: 회원 더미 데이터 생성 및 테스트 파일 추가
zhdiddl 8f803bb
feat: 예약 완료 시 메시지 발송 기능 추가
zhdiddl 8019bcd
refactor: 불필요한 필드 및 클래스 제거
zhdiddl b36f91c
test: 동시성 테스트 작성 및 관련 메서드 추가
zhdiddl 7b3029f
refactor: 불필요한 코드 제거 및 가독성 개선
zhdiddl db53d5e
feat: 예약 서비스에 Pessimistic Lock 적용으로 동시성 해결
zhdiddl 106e92b
refactor: 예약 생성 메서드 책임을 세부 메서드로 분리
zhdiddl ee48288
refactor: 데이터베이스 구조 리팩토링
zhdiddl 93c14b7
refactor: 변경된 구조 기반으로 리포지토리 및 DTO 수정
zhdiddl 5351541
refactor: 변경된 구조 기반으로 DDL 파일 수정
zhdiddl b9672af
feat: 예약 서비스에 Optimistic Lock 적용으로 동시성 해결
zhdiddl 5a29de5
test: 동시성 테스트 작성 및 메서드명 수정
zhdiddl b77c6fb
feat: AOP 기반 분산 락 적용하여 동시성 제어
zhdiddl 3382fb3
feat: 함수형 분산 락 적용하여 동시성 제어
zhdiddl cb2d0f2
fix: 트랜잭션 처리 및 분산 락 동작 개선
zhdiddl 66b4601
refactor: 코드 가독성 개선 및 불필요한 메서드 제거
zhdiddl f82330d
feat: 예외 핸들러 및 예외 코드 추가
zhdiddl 37b606f
refactor: 분산 락 예외 처리 및 해제 로직 개선
zhdiddl f35814a
refactor: 불필요한 메서드 호출 제거
zhdiddl e4e03cf
chore: Redis 타임아웃 및 재시도 설정 추가
zhdiddl be09082
chore: 빌드 설정 및 주석 수정
zhdiddl 06aff06
chore: Redis 설정 추가
zhdiddl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
movie-application/src/main/java/com/example/application/dto/request/MovieSearchCriteria.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.example.application.dto.request; | ||
|
|
||
| import com.example.domain.model.valueObject.Genre; | ||
|
|
||
| public record MovieSearchCriteria( | ||
| String title, | ||
| Genre genre | ||
| ) { | ||
| } |
9 changes: 9 additions & 0 deletions
9
...-application/src/main/java/com/example/application/dto/request/ReservationRequestDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.example.application.dto.request; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ReservationRequestDto( | ||
| Long screeningId, | ||
| Long memberId, | ||
| List<Long> seatIds | ||
| ) {} |
26 changes: 26 additions & 0 deletions
26
...pplication/src/main/java/com/example/application/dto/response/ReservationResponseDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.example.application.dto.response; | ||
|
|
||
| import com.example.domain.model.entity.Reservation; | ||
| import java.time.LocalTime; | ||
| import java.util.List; | ||
|
|
||
| public record ReservationResponseDto( | ||
| String memberName, | ||
| String movieTitle, | ||
| String theaterName, | ||
| LocalTime screeningStartTime, | ||
| List<String> reservedSeats | ||
| ) { | ||
| public static ReservationResponseDto fromEntity(Reservation reservation) { | ||
| return new ReservationResponseDto( | ||
| reservation.getMember().getName(), | ||
| reservation.getScreening().getMovie().getTitle(), | ||
| reservation.getScreening().getTheater().getName(), | ||
| reservation.getScreening().getStartTime(), | ||
| reservation.getReservedSeats().stream() | ||
| .map(rs -> rs.getScreeningSeat().getSeat().getSeatNumber().toString()) | ||
| .toList() | ||
| ); | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
movie-application/src/main/java/com/example/application/lock/DistributedLock.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.example.application.lock; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| @Target(ElementType.METHOD) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| public @interface DistributedLock { | ||
| String key(); | ||
| long waitTime() default 2_000; // 적당한 대기 시간을 고려해 잠금 시간의 2배 정도로 설정 | ||
| long leaseTime() default 1_000; // 지연을 고려해 트랜잭션 평균 실행 시간의 2배 정도로 설정 | ||
| } | ||
|
|
47 changes: 47 additions & 0 deletions
47
movie-application/src/main/java/com/example/application/lock/DistributedLockAspect.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.example.application.lock; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.aspectj.lang.ProceedingJoinPoint; | ||
| import org.aspectj.lang.annotation.Around; | ||
| import org.aspectj.lang.annotation.Aspect; | ||
| import org.redisson.api.RLock; | ||
| import org.redisson.api.RedissonClient; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| @Slf4j | ||
| @Aspect | ||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class DistributedLockAspect { | ||
|
|
||
| private final RedissonClient redissonClient; | ||
|
|
||
| @Around("@annotation(distributedLock)") | ||
| public Object applyLock(ProceedingJoinPoint joinPoint, DistributedLock distributedLock) throws Throwable { | ||
| String lockKey = distributedLock.key(); | ||
| long waitTime = distributedLock.waitTime(); | ||
| long leaseTime = distributedLock.leaseTime(); | ||
|
|
||
| RLock lock = redissonClient.getLock(lockKey); | ||
|
|
||
| boolean acquired = lock.tryLock(waitTime, leaseTime, TimeUnit.MILLISECONDS); | ||
| if (!acquired) { | ||
| log.warn("[Distributed Lock] 락 획득 실패: {}", lockKey); | ||
| throw new RuntimeException("Seat is already reserved by another transaction."); | ||
| } | ||
|
|
||
| try { | ||
| log.info("[Distributed Lock] 락 획득 성공: {}", lockKey); | ||
| return joinPoint.proceed(); | ||
| } finally { | ||
| if (lock.isHeldByCurrentThread()) { | ||
| lock.unlock(); | ||
| log.info("[Distributed Lock] 락 해제 완료: {}", lockKey); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
7 changes: 7 additions & 0 deletions
7
movie-application/src/main/java/com/example/application/lock/DistributedLockExecutor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.example.application.lock; | ||
|
|
||
| import java.util.function.Supplier; | ||
|
|
||
| public interface DistributedLockExecutor { | ||
| <T> T executeWithLock(String key, long waitTime, long leaseTime, Supplier<T> task); | ||
| } |
39 changes: 39 additions & 0 deletions
39
...plication/src/main/java/com/example/application/lock/RedissonDistributedLockExecutor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.example.application.lock; | ||
|
|
||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.function.Supplier; | ||
| import org.redisson.api.RLock; | ||
| import org.redisson.api.RedissonClient; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class RedissonDistributedLockExecutor implements DistributedLockExecutor { | ||
|
|
||
| private final RedissonClient redissonClient; | ||
|
|
||
| public RedissonDistributedLockExecutor(RedissonClient redissonClient) { | ||
| this.redissonClient = redissonClient; | ||
| } | ||
|
|
||
| @Override | ||
| public <T> T executeWithLock(String key, long waitTime, long leaseTime, Supplier<T> task) { | ||
| RLock lock = redissonClient.getLock(key); | ||
| boolean acquired = false; | ||
|
|
||
| try { | ||
| acquired = lock.tryLock(waitTime, leaseTime, TimeUnit.MILLISECONDS); | ||
| if (!acquired) { | ||
| throw new IllegalStateException("[ERROR] Unable to acquire lock for key: " + key); | ||
| } | ||
| return task.get(); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new RuntimeException("[ERROR] Lock acquisition interrupted", e); | ||
| } finally { | ||
| if (acquired) { | ||
| lock.unlock(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
5 changes: 5 additions & 0 deletions
5
movie-application/src/main/java/com/example/application/port/in/MessageServicePort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.example.application.port.in; | ||
|
|
||
| public interface MessageServicePort { | ||
| void send(String message); | ||
| } |
4 changes: 2 additions & 2 deletions
4
movie-application/src/main/java/com/example/application/port/in/MovieServicePort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| package com.example.application.port.in; | ||
|
|
||
| import com.example.application.dto.request.MovieRequestDto; | ||
| import com.example.application.dto.request.MovieSearchCriteria; | ||
| import com.example.application.dto.request.ScreeningRequestDto; | ||
| import com.example.application.dto.response.MovieResponseDto; | ||
| import com.example.domain.model.valueObject.Genre; | ||
| import java.util.List; | ||
|
|
||
| public interface MovieServicePort { | ||
| List<MovieResponseDto> findMovies(String title, Genre genre); | ||
| List<MovieResponseDto> findMovies(MovieSearchCriteria movieSearchCriteria); | ||
| void createMovie(MovieRequestDto movieRequestDto); | ||
| void addScreeningToMovie(Long movieId, ScreeningRequestDto screeningRequestDto); | ||
| } |
8 changes: 8 additions & 0 deletions
8
movie-application/src/main/java/com/example/application/port/in/ReservationServicePort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.example.application.port.in; | ||
|
|
||
| import com.example.application.dto.request.ReservationRequestDto; | ||
| import com.example.application.dto.response.ReservationResponseDto; | ||
|
|
||
| public interface ReservationServicePort { | ||
| ReservationResponseDto create(ReservationRequestDto reservationRequestDto); | ||
| } |
8 changes: 8 additions & 0 deletions
8
movie-application/src/main/java/com/example/application/port/out/MemberRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.Member; | ||
| import java.util.Optional; | ||
|
|
||
| public interface MemberRepositoryPort { | ||
| Optional<Member> findById(Long id); | ||
| } |
10 changes: 2 additions & 8 deletions
10
movie-application/src/main/java/com/example/application/port/out/MovieRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,13 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.application.dto.request.MovieSearchCriteria; | ||
| import com.example.domain.model.entity.Movie; | ||
| import com.example.domain.model.valueObject.Genre; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import org.springframework.data.domain.Sort; | ||
|
|
||
| /** | ||
| * Represents a port for accessing movie data from a persistence layer. | ||
| * This interface provides an abstraction that allows the application layer | ||
| * to interact with various repository implementations | ||
| * (e.g., databases, external APIs). | ||
| */ | ||
| public interface MovieRepositoryPort { | ||
| List<Movie> findBy(String title, Genre genre, Sort sort); | ||
| List<Movie> findBy(MovieSearchCriteria movieSearchCriteria, Sort sort); | ||
| void save(Movie movie); | ||
| Optional<Movie> findById(Long id); | ||
| } |
13 changes: 13 additions & 0 deletions
13
...application/src/main/java/com/example/application/port/out/ReservationRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.Member; | ||
| import com.example.domain.model.entity.Reservation; | ||
| import com.example.domain.model.entity.Screening; | ||
| import java.util.Optional; | ||
|
|
||
| public interface ReservationRepositoryPort { | ||
| void save(Reservation reservation); | ||
| Optional<Reservation> findById(Long id); | ||
| void deleteAll(); | ||
| int countByScreeningAndMember(Screening screening, Member member); | ||
| } |
11 changes: 11 additions & 0 deletions
11
...application/src/main/java/com/example/application/port/out/ReservationValidationPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.ScreeningSeat; | ||
| import com.example.domain.model.entity.Seat; | ||
| import java.util.List; | ||
|
|
||
| public interface ReservationValidationPort { | ||
| void validateMaxSeatsPerScreening(int existingReservations, int newSeatCount); | ||
| void validateSeatsAreConsecutive(List<Seat> seats); | ||
| void validateSeatsExist(List<Long> requestedSeatIds, List<ScreeningSeat> foundSeats); | ||
| } |
8 changes: 8 additions & 0 deletions
8
...pplication/src/main/java/com/example/application/port/out/ReservedSeatRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.ReservedSeat; | ||
| import java.util.List; | ||
|
|
||
| public interface ReservedSeatRepositoryPort { | ||
| void saveAll(List<ReservedSeat> reservedSeats); | ||
| } |
10 changes: 4 additions & 6 deletions
10
...e-application/src/main/java/com/example/application/port/out/ScreeningRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,11 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.Screening; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * Represents a port for accessing movie data from a persistence layer. | ||
| * This interface provides an abstraction that allows the application layer | ||
| * to interact with various repository implementations | ||
| * (e.g., databases, external APIs). | ||
| */ | ||
| public interface ScreeningRepositoryPort { | ||
| void save(Screening screening); | ||
| Optional<Screening> findById(Long id); | ||
| List<Screening> findAll(); | ||
| } |
13 changes: 13 additions & 0 deletions
13
...plication/src/main/java/com/example/application/port/out/ScreeningSeatRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.Screening; | ||
| import com.example.domain.model.entity.ScreeningSeat; | ||
| import java.util.List; | ||
|
|
||
| public interface ScreeningSeatRepositoryPort { | ||
| List<ScreeningSeat> findByScreeningAndSeatIds(Screening screening, List<Long> seatIds); | ||
| void save(ScreeningSeat screeningSeat); | ||
| long count(); | ||
| void resetAllReservations(); | ||
| long countReservedSeats(Long screeningId); | ||
| } |
8 changes: 8 additions & 0 deletions
8
movie-application/src/main/java/com/example/application/port/out/SeatRepositoryPort.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.example.application.port.out; | ||
|
|
||
| import com.example.domain.model.entity.Seat; | ||
| import java.util.List; | ||
|
|
||
| public interface SeatRepositoryPort { | ||
| List<Seat> findAll(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
movie-application/src/main/java/com/example/application/service/MessageService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package com.example.application.service; | ||
|
|
||
| import com.example.application.port.in.MessageServicePort; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Slf4j | ||
| @Service | ||
| public class MessageService implements MessageServicePort { | ||
|
|
||
| @Override | ||
| public void send(String message) { | ||
| try { | ||
| log.info("[MessageService] 전송 시작: {}", message); | ||
| Thread.sleep(500); // 메시지 전송에 걸리는 시간 가정 | ||
| log.info("[MessageService] 전송 완료: {}", message); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); // 현재 스레드가 인터럽트 상태임을 유지하도록 설정 | ||
| log.error("[MessageService] 전송 실패!", e); | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
적절하게 잘 구현해주셨습니다 👍