-
Notifications
You must be signed in to change notification settings - Fork 4
[feat] 자동 정산 기능 최적화 #146
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
Merged
[feat] 자동 정산 기능 최적화 #146
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
dedbf65
refactor: int 타입을 Long 타입으로 변환
gkdudans 38f8498
refactor: 자동 정산 API 트랜잭션 분리 / 비동기 처리
gkdudans 3f5f28d
refactor: int 타입을 Long 타입으로 변환
gkdudans ada5219
refactor: 유저별 정산 멀티쓰레드 처리로 수정
gkdudans 57b38a6
feat: Redis Lua 스크립트 추가
gkdudans 744c4c1
refactor: 가상스레드 상한 조정
gkdudans 4983a63
refactor: Kafka 기본 설정 추가
gkdudans 3a70c0b
feat: Kafka 기본 설정 추가
gkdudans de392e6
refactor: 가상스레드 기반 처리 방법 수정
gkdudans 414c38c
refactor: 배치 크기 제한, 쿼리문 개선
gkdudans 489a8de
refactor: StructuredTaskScope 기반 처리 방법 수정
gkdudans 32223bb
docs: 디버깅용 로그 추가
gkdudans f6a0ff9
Revert "docs: 디버깅용 로그 추가"
gkdudans 2dbcfd8
docs: 디버깅용 로그 제거
gkdudans 8b163de
docs: 디버깅용 로그 제거
gkdudans eb7de53
docs: 디버깅용 로그 제거
gkdudans 363cd2a
refactor: Outbox 쿼리문 변경
gkdudans 60d390a
refactor: 인터럽트 가능한 방식으로 수정
gkdudans 9f1d356
refactor: 카프카 관련 코드 변경사항 반영
gkdudans 3cd7da7
docs: .gitignore 업데이트
gkdudans eb5f87c
Merge branch 'develop' of https://github.com/GoormOnlyOne/OnlyOne-Bac…
gkdudans 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
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,6 @@ | ||
| .gradle | ||
| target | ||
| out | ||
| node_modules | ||
| *.iml | ||
| *.log |
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
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,11 +1,9 @@ | ||
| # 사용할 base 이미지 선택 | ||
| FROM openjdk:21 | ||
| FROM eclipse-temurin:21-jre | ||
| WORKDIR /app | ||
|
|
||
| # build/libs/ 에 있는 jar 파일을 JAR_FILE 변수에 저장 | ||
| ARG JAR_FILE=build/libs/*.jar | ||
|
|
||
| # JAR_FILE을 app.jar로 복사 | ||
| COPY ${JAR_FILE} app.jar | ||
| # 실행 가능한 fat jar만 복사 | ||
| COPY build/libs/onlyone-0.0.1-SNAPSHOT.jar app.jar | ||
|
|
||
| EXPOSE 8080 | ||
| ENTRYPOINT ["java", "-jar", "-Duser.timezone=Asia/Seoul", "app.jar"] | ||
| ENTRYPOINT ["java","--enable-preview","-jar","app.jar"] | ||
|
|
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
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
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
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
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
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
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
34 changes: 34 additions & 0 deletions
34
src/main/java/com/example/onlyone/domain/settlement/dto/event/OutboxEvent.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,34 @@ | ||
| package com.example.onlyone.domain.settlement.dto.event; | ||
|
|
||
| import com.example.onlyone.domain.settlement.entity.OutboxStatus; | ||
| import jakarta.persistence.*; | ||
| import lombok.*; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| @Getter @Setter | ||
| @Entity @Table(name = "outbox_event", indexes = { | ||
| @Index(name = "idx_outbox_new", columnList = "status,id") | ||
| }) | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class OutboxEvent { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String aggregateType; // "UserSettlement" | ||
| private Long aggregateId; // userSettlementId | ||
| private String eventType; // "ParticipantSettlementResult" | ||
| private String keyString; // partition key (e.g., memberWalletId) | ||
|
|
||
| @Lob | ||
| private String payload; // JSON | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| private OutboxStatus status; | ||
|
|
||
| private LocalDateTime createdAt; | ||
| private LocalDateTime publishedAt; | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/example/onlyone/domain/settlement/dto/event/SettlementProcessEvent.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,19 @@ | ||
| package com.example.onlyone.domain.settlement.dto.event; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| public class SettlementProcessEvent { | ||
| private final Long settlementId; | ||
| private final Long scheduleId; | ||
| private final Long clubId; | ||
| private final Long leaderId; | ||
| private final Long leaderWalletId; | ||
| private final Long costPerUser; | ||
| private final Long totalAmount; | ||
| private final List<Long> targetUserIds; | ||
| } |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/example/onlyone/domain/settlement/dto/event/UserSettlementStatusEvent.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,34 @@ | ||
| package com.example.onlyone.domain.settlement.dto.event; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class UserSettlementStatusEvent { | ||
| public enum ResultType { SUCCESS, FAILED } | ||
|
|
||
| private ResultType type; // "SUCCESS" | "FAILED" | ||
| private String operationId; // "stl:4:usr:100234:v1" | ||
| private Instant occurredAt; | ||
|
|
||
| private long settlementId; | ||
| private long userSettlementId; | ||
| private long participantId; | ||
|
|
||
| private long memberWalletId; | ||
| private long leaderId; | ||
| private long leaderWalletId; | ||
| private long amount; | ||
|
|
||
|
|
||
| @Data | ||
| public static class Snapshots { | ||
| private Long memberPostedBalance; | ||
| private Long leaderPostedBalance; | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/example/onlyone/domain/settlement/dto/event/WalletCaptureFailedEvent.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.onlyone.domain.settlement.dto.event; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| public class WalletCaptureFailedEvent { | ||
| private Long userSettlementId; | ||
| private Long memberWalletId; | ||
| private Long leaderWalletId; | ||
| private Long amount; | ||
| private Long memberBalanceBefore; | ||
| private Long leaderBalanceBefore; | ||
| } |
15 changes: 15 additions & 0 deletions
15
...ain/java/com/example/onlyone/domain/settlement/dto/event/WalletCaptureSucceededEvent.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.onlyone.domain.settlement.dto.event; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| public class WalletCaptureSucceededEvent { | ||
| private Long userSettlementId; | ||
| private Long memberWalletId; | ||
| private Long leaderWalletId; | ||
| private Long amount; | ||
| private Long memberBalanceAfter; | ||
| private Long leaderBalanceAfter; | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/example/onlyone/domain/settlement/entity/OutboxStatus.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.onlyone.domain.settlement.entity; | ||
|
|
||
| public enum OutboxStatus { | ||
| NEW, | ||
| PUBLISHED, | ||
| FAILED | ||
| } |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.