Open
Conversation
spring-kang
reviewed
Nov 5, 2025
|
|
||
| private final BinaryContentAsyncWorker binaryContentAsyncWorker; | ||
|
|
||
| @EventListener |
Collaborator
There was a problem hiding this comment.
TransactionalEventListener 를 안쓰고 EventListener를 활용한 의도가 있으신가요?
spring-kang
reviewed
Nov 5, 2025
Comment on lines
+70
to
+73
| BinaryContent binaryContent = new BinaryContent(fileName, (long) bytes.length, | ||
| contentType); | ||
| binaryContentRepository.save(binaryContent); | ||
| eventPublisher.publishEvent(new BinaryContentCreatedEvent(binaryContent.getId(), bytes, fileName, contentType)); |
Collaborator
There was a problem hiding this comment.
여긴 메시지 관련 이벤트에 대한 발행 로직이 들어가야할 것 같습니다.
spring-kang
reviewed
Nov 5, 2025
Comment on lines
+57
to
+69
| @Bean(name = {"taskExecutor", "applicationTaskExecutor"}) | ||
| public Executor taskExecutor(TaskDecorator mdcSecurityContextTaskDecorator) { | ||
| ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
| // 운영 환경에 맞게 조정하세요. | ||
| executor.setCorePoolSize(4); | ||
| executor.setMaxPoolSize(16); | ||
| executor.setQueueCapacity(1000); | ||
| executor.setThreadNamePrefix("async-"); | ||
| executor.setTaskDecorator(mdcSecurityContextTaskDecorator); | ||
| executor.initialize(); | ||
| return executor; | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
이게 더 먼저 선언되면 가독성이 올라갈것 같습니다.
spring-kang
reviewed
Nov 5, 2025
| private final BinaryContentStorage binaryContentStorage; | ||
| private final BinaryContentService binaryContentService; | ||
|
|
||
| @Async |
Collaborator
There was a problem hiding this comment.
빈으로 설정해둔 executor를 명시해주세요.
spring-kang
reviewed
Nov 5, 2025
|
|
||
| @Configuration | ||
| @EnableRetry | ||
| public class RetryConfig { |
Collaborator
There was a problem hiding this comment.
AppConfig를 추가하고 여기에 공통된 기능들을 모으는게 더 자연스러울것 같습니다.
spring-kang
reviewed
Nov 5, 2025
| } | ||
|
|
||
| log.error("S3 업로드 최종 실패(재시도 모두 소진): key={}, reason={}", key, errorMessage, e); | ||
| throw new RuntimeException("S3에 파일 업로드 실패(최종): " + key, e); |
Collaborator
There was a problem hiding this comment.
cusotom exception으로 처리하시는것도 좋을것 같습니다.
spring-kang
approved these changes
Nov 5, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
요구사항
기본
Spring Event - 파일 업로드 로직 분리하기
BinaryContent에 바이너리 데이터 업로드 상태 속성(status)을 추가하세요.
PROCESSING: 업로드 중
SUCCESS: 업로드 완료
FAIL: 업로드 실패
BinaryContent의 상태를 업데이트하는 메소드를 정의하세요.
Spring Event - 알림 기능 추가하기
비동기 적용하기
비동기 실패 처리하기
# 알림 내용 예시 RequestId: 7641467e369e458a98033558a83321fb BinaryContentId: b0549c2a-014c-4761-8b21-4b77d3bd011c Error: The AWS Access Key Id you provided does not exist in our records. (Service: S3, Status Code: 403, Request ID: B7KCVSRCGPYJZREX, Extended Request ID: AWRVuJJJ3upwwOkCnd+yhHkgSajUxdg7L4195lbMVTIka6WnBpjZLLRTReoHbgIMf9zzH/QQM0Y5ZOVJCHF2F+l2mSyPG/+8Ee2XBS8hcqk=) (SDK Attempt Count: 1)캐시 적용하기
심화
주요 변경사항
스크린샷
멘토에게