Mailer

Examples

Runnable workflow examples and service-backed templates.

Local examples

These run with only Go.

go run ./cmd/mailer-workflow --file examples/workflows/wordcount.yaml
go run ./cmd/mailer-workflow --file examples/workflows/order-totals.yaml

Word count

name: wordcount
source:
  type: generator
  records:
    - {key: hello, value: '{"word":"hello"}'}
    - {key: mailer, value: '{"word":"mailer"}'}
    - {key: hello, value: '{"word":"hello"}'}
pipeline:
  - id: by-word
    type: keyBy
    keyBy: {field: word, partitions: 1}
  - id: count
    type: reduce
    reduce: {function: count}
sink:
  type: stdout

Order totals

name: order-totals
source:
  type: generator
  records:
    - key: order-1
      value: '{"customer":{"id":"c1"},"status":"completed","amount":10}'
    - key: order-2
      value: '{"customer":{"id":"c1"},"status":"pending","amount":15}'
    - key: order-3
      value: '{"customer":{"id":"c1"},"status":"completed","amount":5}'
    - key: order-4
      value: '{"customer":{"id":"c2"},"status":"completed","amount":7}'
pipeline:
  - id: completed
    type: filter
    filter: {field: status, operator: equals, value: completed}
  - id: by-customer
    type: keyBy
    keyBy: {field: customer.id, partitions: 1}
  - id: totals
    type: reduce
    reduce: {function: sum, field: amount}
sink:
  type: stdout

Service-backed examples

These require external services and environment variables.

FileRequires
examples/workflows/kafka-to-kafka-exactly-once.yamlKafka and KAFKA_USERNAME / KAFKA_PASSWORD when SASL is enabled.
examples/workflows/postgres-sink.yamlKafka, Postgres, POSTGRES_DSN, and Kafka credentials when SASL is enabled.

Use --dry-run --describe first to validate the config without executing the pipeline.

SDK examples in the repository

DirectoryDemonstrates
examples/wordcountFlatMap, KeyBy, Reduce.
examples/windowingEvent time, watermarks, tumbling windows.
examples/backpressureBounded edges and slow sink backpressure.
examples/exactly-onceKafka source to transactional Kafka sink.
examples/kafka-ordersKafka order pipeline.
examples/kafka-dashboardKafka pipeline with dashboard.
examples/pg-ordersKafka to Postgres.
examples/dashboard-demoMetrics and dashboard demo.

On this page