benthos 8

input - generate

컨텍스트 없이 실행되는 [Bloblang](/docs/guides/bloblang/ about) 매핑을 사용해 지정된 interval마다 메시지를 생성한다. generateReader는 다음처럼 생겼다. type generateReader struct { remaining int batchSize int limited bool firstIsFree bool exec *mapping.Executor timer *time.Ticker schedule *cron.Schedule location *time.Location } generateReader를 생성하는 newGenerateReader함수의 프로토타입. conf는 default 값 + 설정 값이 적용된 상태. func newGenerateReader(m..

manager

config internal/manager/config.go 먼저 볼 것은 manager의 Config 구조체다. 이 구조체는 benthos config에서 리소스 구성 요소를 지정하기 위한 필드가 포함된다. input, processor, output, cache, ratelimit 의 설정을 가진다. type ResourceConfig struct { ResourceInputs []input.Config ResourceProcessors []processor.Config ResourceOutputs []output.Config ResourceCaches []cache.Config ResourceRateLimits []ratelimit.Config }

package import

main.go 의 import 부분을 보면, _ "github.com/benthosdev/benthos/v4/public/compoennts/all" 을 import 하고 있다. 사용하지도 않을 패키지를 뭐하러 import 하고 있을까? /github.com/benthosdev/benthos/v4/public/components/all 을 보면 더 이상하다. _ "github.com/benthosdev/benthos/v4/public/components/amqp09" _ "github.com/benthosdev/benthos/v4/public/components/amqp1" _ "github.com/benthosdev/benthos/v4/public/components/avro" ... 이렇게 패키지를 ..

[benthos] Elasticserach 연결 실패 문제(해결 안됨)

환경 도커 이미지: elasticsearch:8.3.2, elasticsearch:7.10.0 jeffail/benthos:latest(2022-06-23일자), jeffail/benthos:4.0.0 호스트 환경: MacOS Monterey 문제 benthos에서 output을 elasticsearch를 사용할 경우 발생하는 문제 코드, HTTP API request input: label: "" http_server: address: "" timeout: 5s pipeline: processors: - bloblang: | article = article output: label: "" elasticsearch: urls: - "http://localhost:9200/" index: "movies" ..

benthos 2022.07.10

[benthos] bloblang - 1. 시작

https://www.benthos.dev/docs/guides/bloblang/walkthrough Bloblang은 다양한 형식의 데이터를 매핑하기 위해 만든 언어라고 한다. Benthos 내에서 문서 매핑을 한다. Bloblang은 프로세서로 사용할 수 있고, 함수 안에서 blobl 쿼리를 사용할 수 있다. (blobl 은 bloblang 줄임말) Bloblang 예제 input: label: "" http_server: address: "" path: /post allowed_verbs: - POST timeout: 5s rate_limit: "" pipeline: processors: - bloblang: root = content().uppercase() output: stdout: {} pi..

benthos/Bloblang 2022.07.09

[benthos] docker로 시작하기

benthos 설치 링크 https://www.benthos.dev/docs/guides/getting_started benthos 도커 이미지 다운로드 docker pull jeffail/benthos benthos config.yaml 작성 input: label: "" http_server: address: "" path: /post allowed_verbs: - POST timeout: 5s rate_limit: "" pipeline: processors: [] output: label: "" stdout: codec: lines config.yaml에 반드시 있어야 하는 것이 3개 있다. input, pipeline, output 컨테이너 실행 docker run --rm --name benth..

benthos 2022.07.09