Skip to content

docs(examples): add KPipe.bytes example (refs #166)#183

Merged
eschizoid merged 1 commit into
mainfrom
docs/examples-bytes
Jun 18, 2026
Merged

docs(examples): add KPipe.bytes example (refs #166)#183
eschizoid merged 1 commit into
mainfrom
docs/examples-bytes

Conversation

@eschizoid

Copy link
Copy Markdown
Owner

Summary

The audit in #166 flagged that KPipe.bytes(topic, props) was the only bundled format on the fluent facade without a corresponding examples/ module. JSON, Avro, Protobuf, and the multi/demo paths all had complete reference apps; the raw-bytes path did not.

This PR adds examples/bytes to close that gap.

What the example teaches

  • KPipe.bytes(topic, props).toCustom(MessageSink<byte[]>).start() — the simplest possible end-to-end raw-bytes consumer.
  • Demonstrates that the pipeline can stay in byte[] end-to-end with no format SerDe — useful for proxying, raw archival, or pre-format inspection where the consumer doesn't care about the payload structure.
  • The custom MessageSink<byte[]> logs each record's length plus a short hex preview, mirroring what bytesConsoleSink() does internally but inlined so the reader can see how toCustom(...) plugs in.

Structure

Copied from examples/json/:

  • examples/bytes/build.gradle.kts — same shape as the json module, minus the JSON format dep (raw byte[] needs no format module — MessageFormat.bytes() lives in kpipe-core, transitively pulled by kpipe-api).
  • examples/bytes/src/main/java/io/github/eschizoid/kpipe/App.javaAppConfig.fromEnv() + KafkaConsumerConfig + a 5-line MessageSink<byte[]> lambda.
  • settings.gradle.kts — registers examples:bytes.

Refs #166 (does not close — that issue tracks broader audit follow-ups).

Adds an `examples/bytes` module that demonstrates the
`KPipe.bytes(topic, props)` fluent entry point — the only bundled
format without an example before this change (audit finding from
issue #166).

The example wires a `MessageSink<byte[]>` that logs each record's
length plus a short hex preview. Useful as a reference for raw
proxying, archival, or pre-format inspection where the pipeline
stays in `byte[]` end-to-end with no SerDe.
@eschizoid

Copy link
Copy Markdown
Owner Author

@copilot please review

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.08%. Comparing base (50d524e) to head (6a1d74f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #183   +/-   ##
=========================================
  Coverage     77.08%   77.08%           
  Complexity      752      752           
=========================================
  Files            72       72           
  Lines          2858     2858           
  Branches        355      355           
=========================================
  Hits           2203     2203           
  Misses          489      489           
  Partials        166      166           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@eschizoid eschizoid merged commit 491a9a8 into main Jun 18, 2026
4 checks passed
@eschizoid eschizoid deleted the docs/examples-bytes branch June 22, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant