Add docs.nats.io examples to main#49
Conversation
Moves the two documentation examples from the jetstream-docs branch into the batch-publish and direct-batch modules' example sourceSets so they are compiled by the per-module CI workflows instead of living on an unprotected side branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @Jarema's task in 4m 12s —— View job Review
Verdict: looks good with one item to confirm before merge. What was checked
Issues flagged (inline)
|
| PublishAck ack = publisher.commit(SUBJECT, "{\"sku\":\"NATS-CAP\",\"qty\":1}".getBytes()); | ||
|
|
||
| System.out.println("Committed batch [" + publisher.getBatchId() + "]" | ||
| + " of " + ack.getBatchSize() + " line items" |
There was a problem hiding this comment.
ack.getBatchSize() is the only place this method is called in the entire examples codebase — existing examples use pa.getBatchId() and pa.getJv() but not getBatchSize(). Please confirm getBatchSize() exists on io.nats.client.api.PublishAck in jnats 2.25.1. If it's missing, the build will fail silently on this branch until CI runs the bp-* workflow. The rest of the line (getSeqno(), getBatchId()) are verified against other examples.
| static final String NATS_URL = System.getenv("NATS_URL") != null | ||
| ? System.getenv("NATS_URL") : "nats://localhost:4222"; |
There was a problem hiding this comment.
System.getenv("NATS_URL") is called twice. While env vars don't change mid-JVM, the double call is inconsistent with every other example in this repo (all of which hard-code the URL or use a single local variable). Consider either:
| static final String NATS_URL = System.getenv("NATS_URL") != null | |
| ? System.getenv("NATS_URL") : "nats://localhost:4222"; | |
| static final String NATS_URL = "nats://localhost:4222"; |
or a static initializer with a single getenv call. The two-call form also makes it marginally harder to read at a glance.
Mirror the nats.java client layout (examples/.../natsIoDoc/) per review feedback, adding one package level under examples in both modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Moves the two documentation examples from the
jetstream-docsbranch onto main (additive only):batch-publish/src/examples/java/io/synadia/examples/AtomicBatchDocExample.javadirect-batch/src/examples/java/io/synadia/examples/LearnJetStreamGetDirectBatchGet.javaWhy: the new docs.nats.io build fetches these snippets at build time. On the side branch they get zero CI; on main both modules fold
src/examples/javainto the main sourceSet, so the path-filteredbp-*/db-*workflows compile them automatically — no gradle or workflow changes.Note: please keep the
jetstream-docsbranch until the docs repo's fetch config is switched tomain(follow-up PR there).🤖 Generated with Claude Code