분류 전체보기
-
6장 - 응용 서비스와 표현 영역📕 book/도메인 주도 개발 시작하기 2023. 1. 5. 23:41
📍 표현 영역과 응용 영역 도메인이 제 기능을 하기위해서는 사용자와 도메인을 연결해주는 매개체가 필요하다. 응용 영역과 표현 영역이 사용자와 도메인을 연결해주는 매개체 역할을 하게된다. 표현 영역 사용자의 요청을 해석 URL, 요청 파라미터, 쿠키, 헤더 등을 이용해 사용자가 실행하고 싶은 기능을 판별하고 제공하는 응용 서비스를 실행 응용서비스가 요구하는 형식으로 사용자 요청을 변환한다. 응용 영역 실제 사용자가 원하는 기능을 제공 📍응용 서비스의 역할 사용자(클라이언트)가 요청한 기능을 실행한다. 사용자의 요청을 처리하기 위해 리포지터리에서 도메인 객체를 가져와 사용한다. 주요 역할 도메인 객체를 사용해 사용자의 요청을 처리 도메인 영역과 표현 영역을 연결해주는 창구 역할 ⚠️ 응용 서비스는 단순한 형..
-
[RabbitMQ] 한 Queue에서 여러 타입의 Message 처리✉️ MQ 2023. 1. 5. 19:46
❗ 한 개의 Queue에 두 개 이상의 다른 타입 Message가 들어올 때의 처리! 한 개의 Exchange에 한 개의 Queue가 바인딩 된 상태 exchange 타입 - topic 메시지 타입 두 개의 다른 클래스 SampleMessage @Slf4j @Getter @AllArgsConstructor @NoArgsConstructor public class SampleMessage { private String name; private String content; } OtherMessage @Slf4j @Getter @AllArgsConstructor @NoArgsConstructor public class OtherMessage { private String name; private String ..
-
RabbitMQ + Spring Boot(2)✉️ MQ 2023. 1. 5. 18:56
이번엔 Message Sender를 만들고 RestController로 메시지를 보낼 수 있는 API를 만들어 API를 호출하고 메시지 수신을 확인해보고자 한다. 📤 RabbitTemplate을 사용해서 메시지 전송하기 Rabbit Template의 메서드를 이용하여 메시지를 전달할 수 있다. RabbitTemplate Bean 설정 Configuration 클래스에 RabbitTemplate 을 빈으로 설정해준다. @Bean public ConnectionFactory getConnectionFactory() { ConnectionFactory connectionFactory = new CachingConnectionFactory(RABBITMQ_HOST, RABBITMQ_PORT); ((Caching..
-
5장 - 스프링 데이터 JPA를 이용한 조회 기능📕 book/도메인 주도 개발 시작하기 2023. 1. 5. 00:26
❓CQRS 💡 CQRS는 명령(Command) 모델과 조회(Query) 모델을 분리하는 패턴 명령 모델 : 상태를 변경하는 기능 구현할 때 사용 조회 모델 : 데이터를 조회하는 기능을 구현할 때 사용' 엔티티, 애그리거트, 지포지터리 등 모델은 주문 취소, 배송지 변경과 같은 상태를 변경할 때 사용한다. 즉, 도메인 모델은 명령 모델로 주로 사용된다. 반면에 정렬, 페이징, 검색 조건 지정과 같은 기능은 주문 목록, 상품 상세와 같은 조회 기능에 사용된다. 📌 검색을 위한 스펙 검색 조건이 고정되어 있고 단순하다면 특정 조건을 조회하는 기능을 만들면 된다. public interface OrderDataDao { Optional findById(OrderNo id); List findByOrderer(S..
-
Rabbit MQ + Spring Boot(1)✉️ MQ 2023. 1. 4. 21:56
직접 Rabbit MQ를 사용해 간단한 비동기 통신 샘플 프로젝트를 만들어보고자 한다. 📌 RabbitMQ 설치 (Docker) 간단한 프로젝트를 만들 예정이라 Docker를 통해서 RabbitMQ를 설치했다. Docker Hub의 RabbitMQ 페이지 참고 이미지 Pull docker pull rabbitmq // 최신버전 pull docker pull rabbitmq:3.11.5-management // 3.11 버전 pull(버전 명시) 컨테이너 실행 docker run 명령어를 통해 RabbitMQ Container를 실행해준다. docker run -d --hostname rabbitmq -p 5672:5672 -p 15672:15672 --name some-rabbit rabbitmq:3 h..
-
Rabbit MQ✉️ MQ 2023. 1. 4. 00:48
Rabbit MQ 란 ❓ 💡 AMQP (Advanced Message Queing Protocol, MQ 표준 프로토콜)을 따르는 여러 오픈소스 메시지 브로커중 하나 Producer 에서 Consumer로 메시지(요청)를 전달할 때 중간에서 브로커 역할을 한다. 사용 케이스 요청을 많은 사용자에게 전달 요청에 대한 처리 시간이 길때 많은 작업이 요청되어 처리를 해야할 때 요청을 다른 API에게 위임하고 빠른 응답을 할 때 메시지 브로커 💡 메시지 브로커는 - 클라우드 네이티브 - 마이크로서비스 기반 - 서버리스 및 하이브리드 클라우드 아키텍처 를 지원하기 위한 공통 통합 메커니즘을 구축하는데 도움이 되는 애플리케이션간 통신 기술이다. 메시지 브로커는 애플리케이션, 시스템 및 서비스가 서로 간에 통신하고 ..
-
Message Queue 란❓✉️ MQ 2023. 1. 4. 00:04
Message Queue ❓ 💡 Message Queue란 프로세스 간에 데이터를 교환할 때 사용되는 통신 방법 중 하나이다. 더 큰 개념으로는 - MOM(Message Oriented Middleware : 메시지 지향 미들웨어)를 의미한다. 최신 클라우드 아키텍처에서는 애플리케이션이 좀 더 쉽게 개발, 배포 및 유지 관리할 수 있도록 더 작고 독립적인 모듈로 구성한다. MQ는 이런 분산 애플리케이션을 위한 통신 및 조정 기능을 제공 각 모듈 애플리케이션의 코딩을 간소화 동시에 성능, 안정성 및 확장성을 개선 MQ를 사용하면 시스템의 서로 다른 부분이 통신하고 비동기식으로 작업을 처리할 수 있다. MQ는 메시지를 임시로 저장하는 간단한 버퍼를 제공 메시지를 전송 및 수신하기 위해 소프트웨어 구성 요소가..
-
4장 - 리포지터리와 모델 구현📕 book/도메인 주도 개발 시작하기 2023. 1. 2. 23:05
📌 JPA를 이용한 리포지터리 구현 모듈 위치 리포지터리 인터페이스는 애그리거트와 같이 도메인 영역에 속한다. 리포지터리를 구현한 클래스는 인프라스트럭처 영역에 속한다. 가능한 리포지터리 구현 클래스를 인프라스트럭처 영역에 위치시켜서 인프라스트럭처에 대한 의존을 낮춰야 한다. 리포지터리 기본 기능 구현 리포지터리가 제공하는 기본 기능 ID로 애그리거트 조회 애그리거트 저장 리포지터리 인터페이스 - OrderRepository public interface OrderRepository { Order findById(OrderNo no); void save(Order order); } 인터페이스는 애그리거트 루트를 기준으로 작성한다. 애그리거트 조회하는 기능의 이름을 지을때 널리 사용하는 규칙 - ‘find..