프로듀서
-
카프카 핵심 가이드 2 : 프로듀서책책책 책을 읽읍시다/프로그래밍 2023. 6. 9. 21:35
3. 카프카 프로듀서: 카프카에 메세지 쓰기카프카 프로듀서 생성하기 카프카에 메세지를 쓰려면 우선 원하는 속성을 지정해서 프로듀서 객체를 생성해야 한다. 카프카 프로듀서는 아래의 3개의 필수 속성값을 갖는다.bootstrap.servers 카프카 클러스터와 첫 연결을 생성하기 위해 프로듀서가 사용할 브로커의 host:port 목록이다. 이 값은 모든 브로커를 포함할 필요는 없는데, 프로듀서가 첫 연결을 생성한 뒤 추가 정보를 받아오게 되어 있기 때문이다. 다만 브로커 중 하나가 작동을 정지하는 경우에도 프로듀서가 클러스터에 연결할 수 있도록 최소 2개 이상을 지정할 것을 권장한다.key.serializer 카프카에 쓸 레코드의 키의 값을 직렬화하기 위해 사용하는 시리얼라이저(serializer) 클래스의..