Skip to content

Conversation

@HyeonWuJeon
Copy link
Contributor

#1 #23

Type

  • New Feature
  • Refactor
  • Bug Fix
  • CI/CD
  • Set Up
  • Small Correction

개요

리액티브 트랜잭션을 제어하여 트랜잭션 커밋 이후에 Integration Publisher가 수행되도록 로직을 수정함.

작업 내용

  • javax 트랜잭션에서 springframework 트랜잭션으로 변경
  • transactionOperator을 이용한 트랜잭션 제어
  • 메세지 컨슈밍부 로그레벨 변경
  • 메세지 발행부 비동기 블럭으로 변경

user.signOut()
userPort.patch(user)
userEventPublishPort.publishUserSignedOutEvent(UserSignedOutEvent(user.id))
transactionalOperator.executeAndAwait {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'reactive transcation'을 제어하기위한 오퍼레이터 입니다.
콜백접근 방식과 코루틴 연산자를 제공하여 해당 연산자를 채택하였습니다.

'ReactiveTransactionManager'는 반드시 Mono, Flux 등의 reactor 연산자를 제공해야 합니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserSignedOutEvent 생성 하는 영역을 User 애그리거트 안쪽으로 옮겨서 User 애그리거트에게 이벤트 생성 책임을 지우면 어떨까요?
참고: https://www.baeldung.com/spring-data-ddd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은의견 감사합니다!
회원탈퇴에 의해 발생된 '이벤트 발행 객체'가 오로지 User 애그리거트에게 책임을 지울수있는 형태이니 의견주신 디자인을 적용해도 괜찮은 것 같습니다.

userPort.patch(user)
userEventPublishPort.publishUserSignedOutEvent(UserSignedOutEvent(user.id))
transactionalOperator.executeAndAwait {
val user = getUserUseCase.getById(userId)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hee-jin506 님, 의견주신대로 코드 수정하여 반영했습니다.
JPA가 아니다보니, 서비스레이어에 코드가 한줄 늘어버렸네요 ㅜㅜ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants