Skip to Content
파이썬으로 살펴보는 아키텍처 패턴
book

파이썬으로 살펴보는 아키텍처 패턴

by 오현석, 해리 퍼시벌, 밥 그레고리
June 2021
Beginner to intermediate
356 pages
8h 13m
Korean
Hanbit Media, Inc.
Content preview from 파이썬으로 살펴보는 아키텍처 패턴
239
11
이벤트 기반 아키텍처: 이벤트를 사용한 마이크로서비스 통합
client
가 하는 일은 여러 레디스 채널에 메시지를 보내거나 여러 채널에서 메시지를 받는 것이다.
change
_
batch
_
quantity
라는 채널을 사용해 배치 수량 변경 요청을 보내고
line
_
allocated
라는
채널을 리슨해 재할당 이벤트가 도착하는지 살펴본다.
테스트 대상 시스템이 비동기적이므로
tenacity
라이브러리를 재사용해 다시 시도 루프를 추가해야 한
다. 이 라이브러리를 사용하는 첫 번째 이유는
line
_
allocated
메시지가 도착하는 데 시간이 걸리기
때문이다. 두 번째 이유는
line
_
allocated
메시지가 채널을 통해 전달된 유일한 메시지가 아니기 때문
이다.
11.5.1
레디스는 메시지 버스를 감싸는 다른 얇은 어댑터
우리가 사용하는 레디스 발행/구독 리스너(또는
이벤트 소비자
event
consumer
)는 플라스크와 아주
비슷하다. 이벤트 리스너는 외부 세계를 변환해 이벤트로 만든다.
간단한 레디스 메시지 리스너(
src
/
allocation
/
entrypoints
/
redis
_
eventconsumer
.
py
)
r = redis.Redis(**config.get_redis_host_and_port())
def main():
orm.start_mappers() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

효율적인 리눅스 명령어 사용의 기술

효율적인 리눅스 명령어 사용의 기술

Daniel J Barrett
쿠버네티스를 활용한 클라우드 네이티브 데브옵스

쿠버네티스를 활용한 클라우드 네이티브 데브옵스

최경현, 저스틴 도밍거스, 존 어런들

Publisher Resources

ISBN: 9791162244319