SlideShare una empresa de Scribd logo
1 de 69
Descargar para leer sin conexión
Spring Integration을 통해 살펴본

메시징 세계
2015.04.18 

SK planet 이완근
이 완 근
2011.02 ~ 2014.07

NHN Technology Service
2014.07 ~

SK planet
네이버 프로모션 이벤트 개발
네이버지도 파노라마 이미지
구축 웹 플랫폼 개발
Data Service 개발팀
발표자 소개
https://www.facebook.com/wangeunl
이번 세션에서 하고자 하는 것
2.

어떻게 쓰는건지?
3.

예제와 사례
1.

Spring
Integration?

뭐고 왜 쓰는건지?
1.

What is Spring Integration?
Spring Integration? 스프링 통합?

Spring Integration이 뭔지, 왜 쓰는건지 살펴봅시다.
카페에 가서

커피 한 잔 주문해봅시다.
아메리카노 한 잔이요~
뿅이카페
이렇게 하진 안잖아요?
1. 여기 5000원이요~
카운터
2. 거스름 돈 받으세요.
3. 계산 했으니깐 커피 만들어 주세요.
주방4. 네 여깄습니다.
1. 아메리카노 한 잔 계산
보통 이렇게 커피를 주문하죠.
카운터
주방
2. 커피 제작 주문
3. 커피 반환4. 커피 받아가세요.
무슨 차이죠?
2 Transaction 1 Transaction
주문 제작 통합 시스템
우리가 일하는 현장에도 이런 통합이 있습니다.
마일리지 통합 조회 시스템
마일리지

통합 조회 서버
뿅이카페에 내 포인트가 얼마나 있죠?
맛나는 빵집에 내 포인트는요?
잘난다 항공에 내 마일리지는?
이렇게 하진 안잖아요?
마일리지

통합 조회 서버
뿅이카페에 내 포인트가 얼마나 있죠?
뿅이카페

마일리지 서버
저 쪽가서 알아보세요
뿅이카페에 내 포인트가 얼마나 있죠?
결과 응답 (JSON)
뿅이카페에 내 포인트가 얼마나 있죠?
맛나는 빵집에 내 포인트는요?
잘난다 항공에 쌓인 내 마일리지는?
이렇게 할 겁니다.
마일리지

통합 조회 서버
뿅이카페

마일리지 서버
맛나는 빵집

마일리지 서버
잘난다 항공

마일리지 서버
서버마다 통신기법은 다를 수 있습니다.
마일리지

통합 조회 서버
REST API
TCP
JMS JMS
RESTful API 통신 구현 1
마일리지

통합 조회 서버
[GET] 마일리지 조회 REST API
Jakarta HTTP Client를 이용

http://hc.apache.org/
JSON
String url = "http://example.com/point/1";
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(url);
byte[] responseBody = method.getResponseBody();
// responseBody를 통해 byte[] to Object 변환
method.releaseConnection();
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) { … }
준비
실행
결과 반환
RESTful API 통신 구현 2
마일리지
통합 조회 서버
[GET] 마일리지 조회 REST API
Spring Framework의 RestTemplate를 이용

http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#rest-resttemplate
JSON
RestTemplate restTemplate = new RestTemplate();
String uri = "http://example.com/point/{id}";
UriComponents uriComponents =
UriComponentsBuilder.fromUriString(uri)
.build()
.expand("41")
.encode();
URI url = uriComponents.toUri();
Point point = restTemplate.getForObject(url, Point.class);
이대로 끝?
준비
실행 & 결과 반환
RESTful API 통신 구현 3
마일리지
통합 조회 서버
[GET] 마일리지 조회 REST API
Spring Integration Framework을 이용

http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/http.html#http-outbound
JSON
<int:channel id="requestChannel" />
<int:gateway
id="requestGateway"
service-interface="integration.PointRequestGateway"
default-request-channel="requestChannel" />
<int-http:outbound-gateway
request-channel="requestChannel"
url="http://example.com/point/"
http-method="GET"
expected-response-type="java.lang.String" />
@Autowired
PointRequestGateway gateway;
Point point = gateway.getPoint("41");
<int:gateway
id="requestGateway"
service-interface="integration.PointRequestGateway"
default-request-channel="requestChannel" />
<int-http:outbound-gateway
request-channel="requestChannel"
url="http://example.com/point/"
http-method="GET"
expected-response-type="java.lang.String" />
public interface PointRequestGateway {
Point getPoint(String id);
}
Point point = gateway.getPoint("41");
비즈니스 로직과 통신 로직을 분리할 수 있습니다.
무슨 차이죠?
Spring Framework

RestTemplate
Spring Integration Framework

HTTP-outbound-gateway
@Autowired
PointRequestGateway gateway;
Point point = gateway.getPoint("41");
HTTP 말고도 다른 Connectivity도 제공 하는데
Messaging 기반으로 통신 구현을 했습니다.
게다가 Spring Integration에서는
많은 개발자들은 시스템 통합에 대해

이렇게 해결해 왔습니다.
File Transfer

Shared Database

Remote Procedure Invocation

Messaging ?
잠깐 Spring Integration을 이야기 하기 전에...
근데 Messaging이 뭐죠?
Messaging
프로그램 간에 빠르고 신뢰할 수 있는 통신을
비동기 방식으로 가능케 하는 전송 기술
그리고 패턴화도 진행되어 왔습니다.
(메시징을 기준으로)
http://www.enterpriseintegrationpatterns.com/
그리고 패턴화도 진행되어 왔습니다.
http://www.enterpriseintegrationpatterns.com/
Spring Integration
그 패턴을 구현한 프레임워크가 바로...
그 중에서 왜 하필 Spring Integration 인가?
다양한 통신 기술에 대한 Adapter 및 Infrastructure 제공
XML / Java DSL을 이용한 간편한 Infrastructure 구축
Spring Framework의 IoC, DI 사용
간편한 설정
익숙한 환경
다양한 Connectivity
Spring Integration에 대한
FAQ
여기서 잠깐!
Q: Spring Integration을 오늘 처음 봅니다. 뭔 말인지
알겠는데 아직도 내가 왜 써야되는지 모르겠습니다.

이미 앞서 말한 상황에 대해 잘 개발해놔서 서비스 잘 하고
있는데 왜 굳이 이걸 써야되는지를 모르겠습니다.
A:
Q: Spring Integration을 써보고 싶은데 과연 퍼포먼스
는 잘 나올까요?
A:
Q: Apache Camel에 비해 Spring Integration이

뭐가 좋은지 요약해 주세요.
A:
http://java.dzone.com/articles/spring-integration-and-apache
http://java.dzone.com/articles/light-weight-open-source
http://java.dzone.com/articles/which-integration-framework
http://www.slideshare.net/KaiWaehner/spoilt-for-choice-how-to-choose-the
Spring Integration의 구조와 개발 방법에 대해 알아봅시다.
2.

Deep Dive to Spring Integration
Spring Integration History
2007.11.13 - Spring Integration First commit

2008.01.23 - Spring Integration 1.0.0.M1 

2008.11.26 - Spring Integration 1.0.0

2010.11.22 - Spring Integration 2.0.0

2013.12.15 - Spring Integration 3.0

2015.04.03 - Spring Integration 4.1.3
…
Spring Integration을 쓸 때는 이 세 가지만 기억하세요!
Message / Pipes / Filters
Pipes
Filters
Message 오브젝트를 발신 / 수신하기 위한 창구
Message 전송할 데이터가 담긴 Wrapper Class
Message 오브젝트를 발신 / 수신하는 목적지
Pipes
Filters
Message Message
Message Channel
Message Endpoints
참고로 앞에서 봤던 HTTP-outbound-gateway는

메시지 엔드포인트의 일종
Message Endpoints
Message Channel
Business Logic
Message Endpoints
Message Channel
Business Logic
Send Server Receive Server
Spring Integration의 3대 메인 컴포넌트
Business Layer
Integration Layer
Message
Business Layer
Integration Layer
Spring Integration의 3대 메인 컴포넌트
Channel Adapter
Gateway
Business Layer
Send Server
Message Channel
Filter
Transfomer
Router
Service Activator
Message
Message
Message is
목적지로 발신 / 수신할 데이터의 Wrapper Class
Channel Adapter
Gateway
Business Layer
Message Channel
Filter
Transfomer
Router
Service Activator
Message
Message 구조
전송하고자 할 데이터
메시지의 메타 데이터
ex) id, expiredDate
ex) POJO, Serialized Data
1. 직접 메시지 인스턴스화 진행
2. 메시지 빌더를 사용하여 메시지 오브젝트 생성
Message<String> message1 =
MessageBuilder.withPayload("Hello").build();
Message<User> message2 =
MessageBuilder.withPayload(user).build();
import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
Message<String> message1 = new GenericMessage<>("Hello");
Message<User> message2 = new GenericMessage<>(user);
Message 생성 방법
Message Channel
Message Channel is
비지니스 로직과 엔드포인 사이에서 메시지를 보내거나 받는 통로 역할
Channel Adapter
Gateway
Business Layer
Message Channel
Filter
Transfomer
Router
Service Activator
Message
<<interface>>
MessageChannel
Message Channel 분류
<<interface>>
PollableChannel
<<interface>>
SubscribableChannel
Channel
메시지를 임시 버퍼에 저장
send
Channel
메시지 임시저장 X
send
Channel
send receive
Polling 방식의 메시지 수신 요청
Channel
Event-Driven 방식의 메시지 수신
send subscribe
DirectChannelQueueChannel
……
Message Channel 분류
Publish/Subscribe ChannelPoint-to-Point Channel
Channel
1:1 전송 용도
Channel
1:N 전송 용도
DirectChannel
QueueChannel
PublishSubscribeChannel
…
…
Message Channel 단독 사용 예
<int:publish-subscribe-channel id="messageChannel"/>
org.springframework.integration.config.xml.PublishSubscribeChannelParser에 의해
PublishSubscribeChannel로 Bean 타입 결정 & 채널 Bean 인스턴스화
https://github.com/crazybnn/SpringCamp2015_Spring_Integration_Sample_Basic/tree/feature/Chapter02-channel
CoffeeOrder
Manager
Message

Channel
send(커피이름);
Maker 1
Maker 2
Maker 3
subscribe();
Makter 1에서는 아메리카노 메시지만 받게 하려면?
CoffeeOrder
Manager
Message

Channel
send(커피이름);
Maker 1
Maker 2
Maker 3
subscribe();
Makter 1, 2, 3이 외부 서버에 있는 경우에는?
위 궁금증을 해소하기 위한 컴포넌트가 바로

Message Endpoints
Message Endpoints
Message Endpoints is
메시지 채널을 통해 메시지 송수신 등과 같은 처리를 돕는 모듈
Channel Adapter
Gateway
Business Layer
Message Channel
Filter
Transfomer
Router
Service Activator
Message
<int:channel id="helloChannel"/>
XML에 Direct Channel 선언한 다음
@Autowired
private DirectChannel helloChannel;
채널을 DI 받아서
Message<String> message =
MessageBuilder.withPayload("Hello World!").build();
helloChannel.send(message);
전송할 Message 생성 후
채널을 이용해서 send!
메시지를 보내려면….
이 과정은 메시징 프레임워크에 상당히 Coupling 한 작업들….
XML에 Direct Channel 선언하고
<int:gateway id="helloGateway"
service-interface="samples.gateway.HelloMessageGateway">
<int:method name="sendMessage" request-channel="helloChannel"/>
</int:gateway>
Gateway를 선언한 뒤
helloGateway.sendMessage("Hello World!");
Message 오브젝트가 아닌 POJO를 send 할 수 있다!
이를 해소하기 위해 태어난게 Gateway!
@Autowired
private HelloMessageGateway helloGateway;
Gateway를 DI 받으면
<int:channel id="helloChannel"/>
public interface HelloMessageGateway {
void sendMessage(String messageContent);
}
이를 해소하기 위해 태어난게 Gateway!
메시지 생성 / 채널을 이용한 전송과 같은

메시징 프레임워크에 종속된 개발 과정이 제거됨
Gateway를 쓰면 개발자가 정의한 interface으로

Proxy Bean을 제공
helloGateway.sendMessage("Hello World!");
Message 오브젝트가 아닌 POJO를 send 할 수 있다!
Gateway로 해결이 안되는 상황
그럼 Message를 받고 싶을 때는?
<int:channel id="helloChannel">
<int:queue capacity="10"/>
</int:channel>
<int:gateway id="helloGateway"
service-interface="samples.helloworld.HelloGateway">
</int:gateway>
public interface HelloMessageGateway {
String receiveMessage();

}
문제는 reply-channel이 SubscribableChannel 계열일 경우에는 사용 불가
Future<String> receiveMessage();
<int:method name="receiveMessage" reply-channel="helloChannel"/>
이를 해소하기 위해 태어난게 Service Activator!
<int:publish-subscribe-channel id="inputChannel"/>
<int:service-activator id="helloActivator"
input-channel="inputChannel"
ref="helloService"
method="sayHello"/>
<bean id="helloService"
class="integration.samples.HelloService"/>
input-channel에는 Gateway는 달리

PollableChannel, SubscribableChannel 계열 모두 가능
Endpoint 중간 정리
Message
Channel
Gateway
Message Send
Message Receive
Message
Channel
Service
Activator
외부 시스템과 통신하려면?
Message
Channel
Gateway
Outbound
Inbound
Message
Channel
Service

Activator
Spring Integration의 꽃

Channel Adaptor
inbound-channel-adapter
outbound-channel-adapter
Spring Integration이 지원하는 Connectivity
+ Apache Kafka
TCP Inbound & Outbound
직접 시연
Message Endpoints 정리
Gateway 비즈니스 로직에서 메시지 송수신을 쉽게 도와주는 컴포넌트
Service Activator 메시지가 입력 채널에 도착했을 때 특정 빈의 메소드를

호출해주는 컴포넌트
Channel Adapter 외부 시스템과 메시지 송수신 하기 위한 컴포넌트
Transformer 인풋 채널로 들어온 페이로드를 특정 목적에 맞게 변환하여 아웃
풋 채널로 전달하는 엔드포인트
Filter 특정 채널로 어떤 메시지는 전달하지 말아야 할지를 걸러내는

컴포넌트
Router 메시지를 한 개 이상의 채널로 보내는 컴포넌트
Splitter 채널로 들어온 메시지를 여러 조각으로 나눌 때 사용
Aggregator 여러 메시지를 조합하여 하나의 메시지로 통합하는 컴포넌트
Message Bridge 다른 종류의 메시징 채널이나 어댑터를 연결하는 컴포넌트
Message Enricher 수신 메시지에 추가적인 정보를 더하여 확장, 업데이트 된 객체를
하위 소비자에게 전송
Spring Integration 예제 및 응용한 사례를 살펴보겠습니다.
3.

Using Spring Integration
Spring Integration 예제
Simple Integration Exercise
https://github.com/crazybnn/SpringCamp2015_Simple_Integration_Exercise
Simple Integration Exercise 데이터 흐름
/send/jms
/send/nodejs
JMS
ActiveMQ
HTTP
Spring 생산자

서버
Spring 소비자

서버
Nodejs 생산자

서버
https://github.com/crazybnn/SpringCamp2015_Simple_Integration_Exercise
Spring Integration 적용 사례
Spring Integration 적용 전
파노라마 이미지 처리 Batch
이미지 번호

파일 입력
이미지 번호

파일 입력
이미지 번호

파일 입력
이미지 번호

파일 입력
이미지 번호

파일 입력
Spring Integration 적용 사례
Spring Integration 적용 후
파노라마 이미지 처리 Batch
Master Reader
Slave Writer

1
JMS
JMS JMS
…Slave Writer

2
Slave Writer

3
Slave Writer

N
이미지 번호 DB
ActiveMQ
Spring Integration 적용 사례
Spring Integration과 Spring Batch의 결합
파노라마 이미지 처리 Batch
http://docs.spring.io/spring-batch/trunk/reference/html/scalability.html#remoteChunking
Spring Integration 적용 사례
Asynchronous Design with Spring and RTI: 1M Events Per Second

http://www.slideshare.net/SpringCentral/williams-1m-events
Spring Integration 한 번 써볼까?
출처: https://subokim.wordpress.com/2015/04/11/current_and_future_of_software_developers/
멈추지 말고 공부합시다.
기업 통합 패턴 소개

http://www.slideshare.net/barunmo/20141021-40528971
Choosing the Right ESB for Your Integration Needs

http://www.infoq.com/articles/ESB-Integration
Introduction to Spring Integration and Spring Batch

http://www.infoq.com/presentations/Spring-Integration-Batch

Managing and Monitoring Spring Integration Applications

http://www.infoq.com/presentations/Managing-Spring-Integration
감사합니다.

Más contenido relacionado

La actualidad más candente

웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우IMQA
 
Google Cloud IAM 계정, 권한 및 조직 관리
Google Cloud IAM 계정, 권한 및 조직 관리Google Cloud IAM 계정, 권한 및 조직 관리
Google Cloud IAM 계정, 권한 및 조직 관리정명훈 Jerry Jeong
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나종민 김
 
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...Amazon Web Services Korea
 
4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴Terry Cho
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Hyun-Mook Choi
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개if kakao
 
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | EdurekaWhat Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | EdurekaEdureka!
 
Elastic Search (엘라스틱서치) 입문
Elastic Search (엘라스틱서치) 입문Elastic Search (엘라스틱서치) 입문
Elastic Search (엘라스틱서치) 입문SeungHyun Eom
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리YoungHeon (Roy) Kim
 
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]MongoDB
 
The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS NATS
 
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianAPI Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianVahid Rahimian
 
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Ch6 대용량서비스레퍼런스아키텍처 part.1
Ch6 대용량서비스레퍼런스아키텍처 part.1Ch6 대용량서비스레퍼런스아키텍처 part.1
Ch6 대용량서비스레퍼런스아키텍처 part.1Minchul Jung
 
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기NHN FORWARD
 

La actualidad más candente (20)

Spring Core
Spring CoreSpring Core
Spring Core
 
웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우웹서버 부하테스트 실전 노하우
웹서버 부하테스트 실전 노하우
 
Redis
RedisRedis
Redis
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Google Cloud IAM 계정, 권한 및 조직 관리
Google Cloud IAM 계정, 권한 및 조직 관리Google Cloud IAM 계정, 권한 및 조직 관리
Google Cloud IAM 계정, 권한 및 조직 관리
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나엘라스틱서치, 로그스태시, 키바나
엘라스틱서치, 로그스태시, 키바나
 
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
AWS 기반 클라우드 아키텍처 모범사례 - 삼성전자 개발자 포털/개발자 워크스페이스 - 정영준 솔루션즈 아키텍트, AWS / 유현성 수석,...
 
4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴4. 대용량 아키텍쳐 설계 패턴
4. 대용량 아키텍쳐 설계 패턴
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
 
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | EdurekaWhat Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
 
Elastic Search (엘라스틱서치) 입문
Elastic Search (엘라스틱서치) 입문Elastic Search (엘라스틱서치) 입문
Elastic Search (엘라스틱서치) 입문
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리
 
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
Naver속도의, 속도에 의한, 속도를 위한 몽고DB (네이버 컨텐츠검색과 몽고DB) [Naver]
 
The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS The Zen of High Performance Messaging with NATS
The Zen of High Performance Messaging with NATS
 
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid RahimianAPI Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian
 
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017
Amazon SNS로 지속적 관리가 가능한 대용량 푸쉬 시스템 구축 여정 - AWS Summit Seoul 2017
 
Ch6 대용량서비스레퍼런스아키텍처 part.1
Ch6 대용량서비스레퍼런스아키텍처 part.1Ch6 대용량서비스레퍼런스아키텍처 part.1
Ch6 대용량서비스레퍼런스아키텍처 part.1
 
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기
[2019] PAYCO 쇼핑 마이크로서비스 아키텍처(MSA) 전환기
 

Similar a Spring integration을 통해_살펴본_메시징_세계

2Naver Open Android API Translation At DCamp
2Naver Open Android API Translation At DCamp2Naver Open Android API Translation At DCamp
2Naver Open Android API Translation At DCampJeikei Park
 
구글 기술을 이용한 모바일 클라우드 애플리케이션 개발
 구글 기술을 이용한 모바일 클라우드 애플리케이션 개발 구글 기술을 이용한 모바일 클라우드 애플리케이션 개발
구글 기술을 이용한 모바일 클라우드 애플리케이션 개발LGU+
 
Netty 세미나
Netty 세미나Netty 세미나
Netty 세미나Jang Hoon
 
04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)Hankyo
 
파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 Yong Joon Moon
 
ASP.NET Web API를 활용한 RESTful 서비스 개발
ASP.NET Web API를 활용한 RESTful 서비스 개발ASP.NET Web API를 활용한 RESTful 서비스 개발
ASP.NET Web API를 활용한 RESTful 서비스 개발SangHoon Han
 
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http RequestNAVER D2
 
Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Sungjoon Yoon
 
아마존 웹서비스를 이용한 WebApp 제작 Attendee
아마존 웹서비스를 이용한 WebApp 제작 Attendee아마존 웹서비스를 이용한 WebApp 제작 Attendee
아마존 웹서비스를 이용한 WebApp 제작 AttendeeLEEDONGJOON1
 
E2E-Monitor와 Pinpoint 비교
E2E-Monitor와 Pinpoint 비교E2E-Monitor와 Pinpoint 비교
E2E-Monitor와 Pinpoint 비교Jung Kim
 
NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀승명 양
 
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경YoungSu Son
 
반복적인 코드 작업 자동화, Codebone으로 손쉽게
반복적인 코드 작업 자동화, Codebone으로 손쉽게반복적인 코드 작업 자동화, Codebone으로 손쉽게
반복적인 코드 작업 자동화, Codebone으로 손쉽게Sungju Jin
 
2조 프로젝트 보고서 김동현
2조 프로젝트 보고서 김동현2조 프로젝트 보고서 김동현
2조 프로젝트 보고서 김동현kdh24
 
RESTful API 설계
RESTful API 설계RESTful API 설계
RESTful API 설계Jinho Yoo
 
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)KH Park (박경훈)
 
ecdevday3 효율적인 유지보수를 위한 개발 및 관리
ecdevday3 효율적인 유지보수를 위한 개발 및 관리ecdevday3 효율적인 유지보수를 위한 개발 및 관리
ecdevday3 효율적인 유지보수를 위한 개발 및 관리Kenu, GwangNam Heo
 
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable FunctionsJongin Lee
 
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIHyunghun Cho
 

Similar a Spring integration을 통해_살펴본_메시징_세계 (20)

2Naver Open Android API Translation At DCamp
2Naver Open Android API Translation At DCamp2Naver Open Android API Translation At DCamp
2Naver Open Android API Translation At DCamp
 
구글 기술을 이용한 모바일 클라우드 애플리케이션 개발
 구글 기술을 이용한 모바일 클라우드 애플리케이션 개발 구글 기술을 이용한 모바일 클라우드 애플리케이션 개발
구글 기술을 이용한 모바일 클라우드 애플리케이션 개발
 
Netty 세미나
Netty 세미나Netty 세미나
Netty 세미나
 
04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)
 
파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 파이썬 플라스크 이해하기
파이썬 플라스크 이해하기
 
ASP.NET Web API를 활용한 RESTful 서비스 개발
ASP.NET Web API를 활용한 RESTful 서비스 개발ASP.NET Web API를 활용한 RESTful 서비스 개발
ASP.NET Web API를 활용한 RESTful 서비스 개발
 
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request
[D2 CAMPUS] 안드로이드 오픈소스 스터디자료 - Http Request
 
Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)Ksug 세미나 (윤성준) (20121208)
Ksug 세미나 (윤성준) (20121208)
 
아마존 웹서비스를 이용한 WebApp 제작 Attendee
아마존 웹서비스를 이용한 WebApp 제작 Attendee아마존 웹서비스를 이용한 WebApp 제작 Attendee
아마존 웹서비스를 이용한 WebApp 제작 Attendee
 
E2E-Monitor와 Pinpoint 비교
E2E-Monitor와 Pinpoint 비교E2E-Monitor와 Pinpoint 비교
E2E-Monitor와 Pinpoint 비교
 
NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀NDC 11 자이언트 서버의 비밀
NDC 11 자이언트 서버의 비밀
 
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
#19.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
 
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경
[NEXT] 화면 재갱신이 되는 안드로이드 앱 만들기 - 네트워크에 독립하는 구조로 변경
 
반복적인 코드 작업 자동화, Codebone으로 손쉽게
반복적인 코드 작업 자동화, Codebone으로 손쉽게반복적인 코드 작업 자동화, Codebone으로 손쉽게
반복적인 코드 작업 자동화, Codebone으로 손쉽게
 
2조 프로젝트 보고서 김동현
2조 프로젝트 보고서 김동현2조 프로젝트 보고서 김동현
2조 프로젝트 보고서 김동현
 
RESTful API 설계
RESTful API 설계RESTful API 설계
RESTful API 설계
 
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)
3일차-닷넷 분산 기술의 이해 (인피니트 강의자료)
 
ecdevday3 효율적인 유지보수를 위한 개발 및 관리
ecdevday3 효율적인 유지보수를 위한 개발 및 관리ecdevday3 효율적인 유지보수를 위한 개발 및 관리
ecdevday3 효율적인 유지보수를 위한 개발 및 관리
 
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions
코드로 바로 해버리는 서버리스 오케스트레이션 - Azure Durable Functions
 
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open APIDo IoT Yourself! - 사물 간의 연결을 위한 Open API
Do IoT Yourself! - 사물 간의 연결을 위한 Open API
 

Spring integration을 통해_살펴본_메시징_세계

  • 1. Spring Integration을 통해 살펴본 메시징 세계 2015.04.18 SK planet 이완근
  • 2. 이 완 근 2011.02 ~ 2014.07 NHN Technology Service 2014.07 ~ SK planet 네이버 프로모션 이벤트 개발 네이버지도 파노라마 이미지 구축 웹 플랫폼 개발 Data Service 개발팀 발표자 소개 https://www.facebook.com/wangeunl
  • 3. 이번 세션에서 하고자 하는 것 2. 어떻게 쓰는건지? 3. 예제와 사례 1. Spring Integration? 뭐고 왜 쓰는건지?
  • 4. 1. What is Spring Integration? Spring Integration? 스프링 통합? Spring Integration이 뭔지, 왜 쓰는건지 살펴봅시다.
  • 5. 카페에 가서 커피 한 잔 주문해봅시다. 아메리카노 한 잔이요~ 뿅이카페
  • 6. 이렇게 하진 안잖아요? 1. 여기 5000원이요~ 카운터 2. 거스름 돈 받으세요. 3. 계산 했으니깐 커피 만들어 주세요. 주방4. 네 여깄습니다.
  • 7. 1. 아메리카노 한 잔 계산 보통 이렇게 커피를 주문하죠. 카운터 주방 2. 커피 제작 주문 3. 커피 반환4. 커피 받아가세요.
  • 8. 무슨 차이죠? 2 Transaction 1 Transaction 주문 제작 통합 시스템 우리가 일하는 현장에도 이런 통합이 있습니다.
  • 9. 마일리지 통합 조회 시스템 마일리지 통합 조회 서버 뿅이카페에 내 포인트가 얼마나 있죠? 맛나는 빵집에 내 포인트는요? 잘난다 항공에 내 마일리지는?
  • 10. 이렇게 하진 안잖아요? 마일리지 통합 조회 서버 뿅이카페에 내 포인트가 얼마나 있죠? 뿅이카페 마일리지 서버 저 쪽가서 알아보세요 뿅이카페에 내 포인트가 얼마나 있죠? 결과 응답 (JSON)
  • 11. 뿅이카페에 내 포인트가 얼마나 있죠? 맛나는 빵집에 내 포인트는요? 잘난다 항공에 쌓인 내 마일리지는? 이렇게 할 겁니다. 마일리지 통합 조회 서버 뿅이카페 마일리지 서버 맛나는 빵집 마일리지 서버 잘난다 항공 마일리지 서버
  • 12. 서버마다 통신기법은 다를 수 있습니다. 마일리지 통합 조회 서버 REST API TCP JMS JMS
  • 13. RESTful API 통신 구현 1 마일리지 통합 조회 서버 [GET] 마일리지 조회 REST API Jakarta HTTP Client를 이용 http://hc.apache.org/ JSON
  • 14. String url = "http://example.com/point/1"; HttpClient client = new HttpClient(); GetMethod method = new GetMethod(url); byte[] responseBody = method.getResponseBody(); // responseBody를 통해 byte[] to Object 변환 method.releaseConnection(); int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { … } 준비 실행 결과 반환
  • 15. RESTful API 통신 구현 2 마일리지 통합 조회 서버 [GET] 마일리지 조회 REST API Spring Framework의 RestTemplate를 이용 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#rest-resttemplate JSON
  • 16. RestTemplate restTemplate = new RestTemplate(); String uri = "http://example.com/point/{id}"; UriComponents uriComponents = UriComponentsBuilder.fromUriString(uri) .build() .expand("41") .encode(); URI url = uriComponents.toUri(); Point point = restTemplate.getForObject(url, Point.class); 이대로 끝? 준비 실행 & 결과 반환
  • 17. RESTful API 통신 구현 3 마일리지 통합 조회 서버 [GET] 마일리지 조회 REST API Spring Integration Framework을 이용 http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/http.html#http-outbound JSON
  • 18. <int:channel id="requestChannel" /> <int:gateway id="requestGateway" service-interface="integration.PointRequestGateway" default-request-channel="requestChannel" /> <int-http:outbound-gateway request-channel="requestChannel" url="http://example.com/point/" http-method="GET" expected-response-type="java.lang.String" /> @Autowired PointRequestGateway gateway; Point point = gateway.getPoint("41"); <int:gateway id="requestGateway" service-interface="integration.PointRequestGateway" default-request-channel="requestChannel" /> <int-http:outbound-gateway request-channel="requestChannel" url="http://example.com/point/" http-method="GET" expected-response-type="java.lang.String" /> public interface PointRequestGateway { Point getPoint(String id); } Point point = gateway.getPoint("41");
  • 19. 비즈니스 로직과 통신 로직을 분리할 수 있습니다. 무슨 차이죠? Spring Framework RestTemplate Spring Integration Framework HTTP-outbound-gateway @Autowired PointRequestGateway gateway; Point point = gateway.getPoint("41");
  • 20. HTTP 말고도 다른 Connectivity도 제공 하는데 Messaging 기반으로 통신 구현을 했습니다. 게다가 Spring Integration에서는
  • 21. 많은 개발자들은 시스템 통합에 대해 이렇게 해결해 왔습니다. File Transfer Shared Database Remote Procedure Invocation Messaging ? 잠깐 Spring Integration을 이야기 하기 전에...
  • 22. 근데 Messaging이 뭐죠? Messaging 프로그램 간에 빠르고 신뢰할 수 있는 통신을 비동기 방식으로 가능케 하는 전송 기술
  • 23. 그리고 패턴화도 진행되어 왔습니다. (메시징을 기준으로) http://www.enterpriseintegrationpatterns.com/
  • 24. 그리고 패턴화도 진행되어 왔습니다. http://www.enterpriseintegrationpatterns.com/
  • 25. Spring Integration 그 패턴을 구현한 프레임워크가 바로...
  • 26. 그 중에서 왜 하필 Spring Integration 인가? 다양한 통신 기술에 대한 Adapter 및 Infrastructure 제공 XML / Java DSL을 이용한 간편한 Infrastructure 구축 Spring Framework의 IoC, DI 사용 간편한 설정 익숙한 환경 다양한 Connectivity
  • 28. Q: Spring Integration을 오늘 처음 봅니다. 뭔 말인지 알겠는데 아직도 내가 왜 써야되는지 모르겠습니다. 이미 앞서 말한 상황에 대해 잘 개발해놔서 서비스 잘 하고 있는데 왜 굳이 이걸 써야되는지를 모르겠습니다. A:
  • 29. Q: Spring Integration을 써보고 싶은데 과연 퍼포먼스 는 잘 나올까요? A:
  • 30. Q: Apache Camel에 비해 Spring Integration이 뭐가 좋은지 요약해 주세요. A: http://java.dzone.com/articles/spring-integration-and-apache http://java.dzone.com/articles/light-weight-open-source http://java.dzone.com/articles/which-integration-framework http://www.slideshare.net/KaiWaehner/spoilt-for-choice-how-to-choose-the
  • 31. Spring Integration의 구조와 개발 방법에 대해 알아봅시다. 2. Deep Dive to Spring Integration
  • 32. Spring Integration History 2007.11.13 - Spring Integration First commit 2008.01.23 - Spring Integration 1.0.0.M1 2008.11.26 - Spring Integration 1.0.0 2010.11.22 - Spring Integration 2.0.0 2013.12.15 - Spring Integration 3.0 2015.04.03 - Spring Integration 4.1.3 …
  • 33. Spring Integration을 쓸 때는 이 세 가지만 기억하세요! Message / Pipes / Filters
  • 34. Pipes Filters Message 오브젝트를 발신 / 수신하기 위한 창구 Message 전송할 데이터가 담긴 Wrapper Class Message 오브젝트를 발신 / 수신하는 목적지
  • 35. Pipes Filters Message Message Message Channel Message Endpoints 참고로 앞에서 봤던 HTTP-outbound-gateway는 메시지 엔드포인트의 일종
  • 36. Message Endpoints Message Channel Business Logic Message Endpoints Message Channel Business Logic Send Server Receive Server Spring Integration의 3대 메인 컴포넌트 Business Layer Integration Layer Message Business Layer Integration Layer
  • 37. Spring Integration의 3대 메인 컴포넌트 Channel Adapter Gateway Business Layer Send Server Message Channel Filter Transfomer Router Service Activator Message
  • 39. Message is 목적지로 발신 / 수신할 데이터의 Wrapper Class Channel Adapter Gateway Business Layer Message Channel Filter Transfomer Router Service Activator Message
  • 40. Message 구조 전송하고자 할 데이터 메시지의 메타 데이터 ex) id, expiredDate ex) POJO, Serialized Data
  • 41. 1. 직접 메시지 인스턴스화 진행 2. 메시지 빌더를 사용하여 메시지 오브젝트 생성 Message<String> message1 = MessageBuilder.withPayload("Hello").build(); Message<User> message2 = MessageBuilder.withPayload(user).build(); import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; Message<String> message1 = new GenericMessage<>("Hello"); Message<User> message2 = new GenericMessage<>(user); Message 생성 방법
  • 43. Message Channel is 비지니스 로직과 엔드포인 사이에서 메시지를 보내거나 받는 통로 역할 Channel Adapter Gateway Business Layer Message Channel Filter Transfomer Router Service Activator Message
  • 44. <<interface>> MessageChannel Message Channel 분류 <<interface>> PollableChannel <<interface>> SubscribableChannel Channel 메시지를 임시 버퍼에 저장 send Channel 메시지 임시저장 X send Channel send receive Polling 방식의 메시지 수신 요청 Channel Event-Driven 방식의 메시지 수신 send subscribe DirectChannelQueueChannel ……
  • 45. Message Channel 분류 Publish/Subscribe ChannelPoint-to-Point Channel Channel 1:1 전송 용도 Channel 1:N 전송 용도 DirectChannel QueueChannel PublishSubscribeChannel … …
  • 46. Message Channel 단독 사용 예 <int:publish-subscribe-channel id="messageChannel"/> org.springframework.integration.config.xml.PublishSubscribeChannelParser에 의해 PublishSubscribeChannel로 Bean 타입 결정 & 채널 Bean 인스턴스화 https://github.com/crazybnn/SpringCamp2015_Spring_Integration_Sample_Basic/tree/feature/Chapter02-channel CoffeeOrder Manager Message Channel send(커피이름); Maker 1 Maker 2 Maker 3 subscribe();
  • 47. Makter 1에서는 아메리카노 메시지만 받게 하려면? CoffeeOrder Manager Message Channel send(커피이름); Maker 1 Maker 2 Maker 3 subscribe(); Makter 1, 2, 3이 외부 서버에 있는 경우에는? 위 궁금증을 해소하기 위한 컴포넌트가 바로 Message Endpoints
  • 49. Message Endpoints is 메시지 채널을 통해 메시지 송수신 등과 같은 처리를 돕는 모듈 Channel Adapter Gateway Business Layer Message Channel Filter Transfomer Router Service Activator Message
  • 50. <int:channel id="helloChannel"/> XML에 Direct Channel 선언한 다음 @Autowired private DirectChannel helloChannel; 채널을 DI 받아서 Message<String> message = MessageBuilder.withPayload("Hello World!").build(); helloChannel.send(message); 전송할 Message 생성 후 채널을 이용해서 send! 메시지를 보내려면…. 이 과정은 메시징 프레임워크에 상당히 Coupling 한 작업들….
  • 51. XML에 Direct Channel 선언하고 <int:gateway id="helloGateway" service-interface="samples.gateway.HelloMessageGateway"> <int:method name="sendMessage" request-channel="helloChannel"/> </int:gateway> Gateway를 선언한 뒤 helloGateway.sendMessage("Hello World!"); Message 오브젝트가 아닌 POJO를 send 할 수 있다! 이를 해소하기 위해 태어난게 Gateway! @Autowired private HelloMessageGateway helloGateway; Gateway를 DI 받으면 <int:channel id="helloChannel"/> public interface HelloMessageGateway { void sendMessage(String messageContent); }
  • 52. 이를 해소하기 위해 태어난게 Gateway! 메시지 생성 / 채널을 이용한 전송과 같은 메시징 프레임워크에 종속된 개발 과정이 제거됨 Gateway를 쓰면 개발자가 정의한 interface으로 Proxy Bean을 제공 helloGateway.sendMessage("Hello World!"); Message 오브젝트가 아닌 POJO를 send 할 수 있다!
  • 53. Gateway로 해결이 안되는 상황 그럼 Message를 받고 싶을 때는? <int:channel id="helloChannel"> <int:queue capacity="10"/> </int:channel> <int:gateway id="helloGateway" service-interface="samples.helloworld.HelloGateway"> </int:gateway> public interface HelloMessageGateway { String receiveMessage();
 } 문제는 reply-channel이 SubscribableChannel 계열일 경우에는 사용 불가 Future<String> receiveMessage(); <int:method name="receiveMessage" reply-channel="helloChannel"/>
  • 54. 이를 해소하기 위해 태어난게 Service Activator! <int:publish-subscribe-channel id="inputChannel"/> <int:service-activator id="helloActivator" input-channel="inputChannel" ref="helloService" method="sayHello"/> <bean id="helloService" class="integration.samples.HelloService"/> input-channel에는 Gateway는 달리 PollableChannel, SubscribableChannel 계열 모두 가능
  • 55. Endpoint 중간 정리 Message Channel Gateway Message Send Message Receive Message Channel Service Activator 외부 시스템과 통신하려면?
  • 57. Spring Integration이 지원하는 Connectivity + Apache Kafka
  • 58. TCP Inbound & Outbound 직접 시연
  • 59. Message Endpoints 정리 Gateway 비즈니스 로직에서 메시지 송수신을 쉽게 도와주는 컴포넌트 Service Activator 메시지가 입력 채널에 도착했을 때 특정 빈의 메소드를 호출해주는 컴포넌트 Channel Adapter 외부 시스템과 메시지 송수신 하기 위한 컴포넌트 Transformer 인풋 채널로 들어온 페이로드를 특정 목적에 맞게 변환하여 아웃 풋 채널로 전달하는 엔드포인트 Filter 특정 채널로 어떤 메시지는 전달하지 말아야 할지를 걸러내는 컴포넌트 Router 메시지를 한 개 이상의 채널로 보내는 컴포넌트 Splitter 채널로 들어온 메시지를 여러 조각으로 나눌 때 사용 Aggregator 여러 메시지를 조합하여 하나의 메시지로 통합하는 컴포넌트 Message Bridge 다른 종류의 메시징 채널이나 어댑터를 연결하는 컴포넌트 Message Enricher 수신 메시지에 추가적인 정보를 더하여 확장, 업데이트 된 객체를 하위 소비자에게 전송
  • 60. Spring Integration 예제 및 응용한 사례를 살펴보겠습니다. 3. Using Spring Integration
  • 61. Spring Integration 예제 Simple Integration Exercise https://github.com/crazybnn/SpringCamp2015_Simple_Integration_Exercise
  • 62. Simple Integration Exercise 데이터 흐름 /send/jms /send/nodejs JMS ActiveMQ HTTP Spring 생산자 서버 Spring 소비자 서버 Nodejs 생산자 서버 https://github.com/crazybnn/SpringCamp2015_Simple_Integration_Exercise
  • 63. Spring Integration 적용 사례 Spring Integration 적용 전 파노라마 이미지 처리 Batch 이미지 번호 파일 입력 이미지 번호 파일 입력 이미지 번호 파일 입력 이미지 번호 파일 입력 이미지 번호 파일 입력
  • 64. Spring Integration 적용 사례 Spring Integration 적용 후 파노라마 이미지 처리 Batch Master Reader Slave Writer 1 JMS JMS JMS …Slave Writer 2 Slave Writer 3 Slave Writer N 이미지 번호 DB ActiveMQ
  • 65. Spring Integration 적용 사례 Spring Integration과 Spring Batch의 결합 파노라마 이미지 처리 Batch http://docs.spring.io/spring-batch/trunk/reference/html/scalability.html#remoteChunking
  • 66. Spring Integration 적용 사례 Asynchronous Design with Spring and RTI: 1M Events Per Second http://www.slideshare.net/SpringCentral/williams-1m-events
  • 67. Spring Integration 한 번 써볼까? 출처: https://subokim.wordpress.com/2015/04/11/current_and_future_of_software_developers/
  • 68. 멈추지 말고 공부합시다. 기업 통합 패턴 소개 http://www.slideshare.net/barunmo/20141021-40528971 Choosing the Right ESB for Your Integration Needs http://www.infoq.com/articles/ESB-Integration Introduction to Spring Integration and Spring Batch http://www.infoq.com/presentations/Spring-Integration-Batch Managing and Monitoring Spring Integration Applications http://www.infoq.com/presentations/Managing-Spring-Integration