Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ retry, or work them using the same database.

## Installation

Java 21 or newer is required. Add `com.riverqueue:river:0.48.0-alpha.1` and a JDBC driver to your application's dependencies. Jackson 3 is included transitively. Applications do not need Go.
Java 21 or newer is required. Add `com.riverqueue:river:0.48.0-alpha.1` and a JDBC driver to your application's dependencies. Jackson 3 is included transitively.

```xml
<dependency>
Expand Down Expand Up @@ -79,7 +79,7 @@ for each operation. River never closes an application-owned data source. An
## Migration CLI

The `river-cli` executable JAR includes Postgres and SQLite JDBC drivers and
runs with Java 21 or newer. It needs no Go installation or application classpath.
runs with Java 21 or newer. It needs no application classpath.
For a local build, see the [development guide](docs/development.md#building-from-source). Set `RIVER_CLI` to the executable JAR, then run:

```sh
Expand Down Expand Up @@ -125,8 +125,8 @@ for SQLite, or select the dialect through the URL. Export accepts comma-separate
setup when exporting for another migration framework. Exit codes are `0` for
success, `1` for an operation failure, and `2` for invalid arguments.

The [migration history](https://riverqueue.com/docs/migrations) is shared with Go
and the other ports. Use the CLI version matching your Java library. The Java
The [migration history](https://riverqueue.com/docs/migrations) is shared with
River clients in other languages. Use the CLI version matching your Java library. The Java
API remains available for embedded use:

```java
Expand Down Expand Up @@ -200,9 +200,9 @@ Typed retrieval checks the kind and decodes the arguments.
Insertion results contain `Job<JsonNode>` because uniqueness can return an
existing job with another kind or argument schema. The returned arguments are
the persisted values, including any additional fields written by another language.
See the [API comparison](API.md) for the Go mapping and prerelease API changes.
See the [API review](API.md) for the full application surface and prerelease API changes.

Lists default to ascending job ID order, matching Go. Keep the filters and order
Lists default to ascending job ID order. Keep the filters and order
unchanged when continuing from a page's cursor:

```java
Expand Down Expand Up @@ -279,7 +279,7 @@ workerConfig.add(email, context -> {

Long-running handlers should check cancellation between operations and use
interruptible I/O. `context.awaitCancellation()` waits for the signal.
As in Go, a normal return reports success even if cancellation or a timeout was
A normal return reports success even if cancellation or a timeout was
requested. Call `context.checkCancelled()` when abandoning unfinished work.

### Getting the client within workers
Expand Down Expand Up @@ -329,8 +329,8 @@ reporting hooks fast and avoid throwing from them.
### Job-persisted logging

[Job logs](https://riverqueue.com/docs/job-logging) live in `river:log` metadata
as an array of `{attempt, log}` objects. Java has no bundled equivalent of Go's
`riverlog` middleware yet. You can explicitly write that shared format; this
as an array of `{attempt, log}` objects. Java has no bundled job-logging
middleware yet. You can explicitly write that shared format; this
example appends a fixed message and retains the last ten attempt entries.

```java
Expand Down Expand Up @@ -398,8 +398,8 @@ zone when run by workers, including daylight-saving changes. Use an explicit
zone when leaders may run in different time zones. Direct `schedule.next(...)`
calls use the reference time's zone or fixed offset unless the expression
specifies one; pass a `ZonedDateTime` to retain a named zone's daylight-saving rules.
Time-zone rules come from the JVM; matching Go and Java schedules requires
matching time-zone data in both deployments.
Time-zone rules come from the JVM; schedules computed by River clients in other
languages match only when they use the same time-zone data.

```java
var workerConfig = client.workers()
Expand Down Expand Up @@ -452,7 +452,7 @@ workerConfig.add(email, context -> {

For loops, `context.stepWithCursor(name, cursor -> ...)` receives a saved JSON
cursor, and `context.cursor(value)` updates it. Java buffers step progress until
the attempt ends; it does not yet expose Go's transactional checkpoint helpers.
the attempt ends; it does not yet expose transactional checkpoint helpers.
A process crash can lose buffered progress, so steps must remain idempotent.

### Scheduled jobs
Expand Down Expand Up @@ -535,7 +535,7 @@ void completes(@org.junit.jupiter.api.io.TempDir java.nio.file.Path directory) t

`new Client(database, clock)` accepts an injected `Clock` for deterministic insert
timestamps. The worker runtime uses wall time. Java does not currently provide
a separate equivalent of Go's `rivertest.Worker` harness.
a dedicated worker-test harness.

### Transactional job completion

Expand All @@ -559,8 +559,8 @@ workerConfig.add(email, context -> {

[Uniqueness](https://riverqueue.com/docs/unique-jobs) can combine arguments,
queue, time period, and job states. A duplicate insert returns the existing job
with `uniqueSkippedAsDuplicate()` set. The key format is shared with Go and the
other ports.
with `uniqueSkippedAsDuplicate()` set. The key format is shared with River
clients in other languages.

```java
var options = InsertOptions.builder()
Expand Down Expand Up @@ -663,7 +663,7 @@ reindexing configured Postgres indexes. Leadership is enabled by default.
`rescueAfter` must not be shorter than `jobTimeout`, so another client does not
rescue an attempt that is still allowed to run. Its default is one hour, plus an
explicitly configured positive job timeout. Worker durations and snooze delays
must fit in signed 64-bit nanoseconds, the same range as Go's `time.Duration`.
must fit in signed 64-bit nanoseconds, up to about 292 years.

```java
var workerConfig = client.workers()
Expand All @@ -676,8 +676,8 @@ Retention arguments are cancelled, completed, and discarded durations, in that
order. Negative durations retain that state indefinitely. If a runtime uses
`leadership(false)`, another eligible client must run maintenance; periodic
registrations require leadership. `workers.isLeader()` reports the local status.
Leadership leases last `serviceInterval` plus ten seconds, matching Go's renewal
margin even when the interval is increased.
Leadership leases last `serviceInterval` plus ten seconds, keeping the same
renewal margin even when the interval is increased.
`serviceInterval` also controls maintenance and queue heartbeats. It must be
positive and shorter than one day, the retention period for inactive queues.
Short retries and snoozes, including rescued retries, use timed fetch wake-ups
Expand Down
4 changes: 2 additions & 2 deletions java/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Run commands from the repository root unless a section says otherwise. See the [

## Building from source

Install the Go version specified by [`go.work`](../../go.work), Maven, and JDK 21 or 25. Set `JAVA_HOME` and `PATH` to that JDK; the pinned formatter does not run on JDK 27. Go is needed to generate test fixtures, but applications using River do not need Go.
Install the Go version specified by [`go.work`](../../go.work), Maven, and JDK 21 or 25. Set `JAVA_HOME` and `PATH` to that JDK; the pinned formatter does not run on JDK 27. Go is needed to generate test fixtures.

Generate the fixtures and install the Java artifacts into your local Maven repository:

Expand Down Expand Up @@ -58,7 +58,7 @@ payloads, and immediate leadership wakeup after a peer resigns.
Uniqueness tests include the raw JSON fixtures for duplicate keys and integer-like
map keys. Protocol tests exercise both retry jitter boundaries, decode stored
states and uniqueness bits, and verify periodic IDs, insert nonces, resumable
checkpoints, output, and rescue counters using Go's metadata keys.
checkpoints, output, and rescue counters using River's reserved metadata keys.

`make generate/java-migrations` syncs SQL and the migration catalog from the
canonical Go drivers. `verify/java-migrations` detects changed, missing, or extra
Expand Down
2 changes: 1 addition & 1 deletion java/river/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.riverqueue</groupId><artifactId>river-java</artifactId><version>0.48.0-alpha.1</version></parent>
<artifactId>river</artifactId>
<description>Transactional jobs interoperable with River Go</description>
<description>Transactional jobs interoperable with River clients in other languages</description>
<licenses><license><name>Mozilla Public License 2.0</name><url>https://mozilla.org/MPL/2.0/</url><distribution>repo</distribution></license></licenses>
<dependencies>
<dependency><groupId>tools.jackson.core</groupId><artifactId>jackson-databind</artifactId></dependency>
Expand Down
2 changes: 1 addition & 1 deletion java/river/src/main/java/com/riverqueue/Migrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.List;
import java.util.Objects;

/** Applies the exact, versioned River migration line shared with Go. */
/** Applies the exact, versioned River migration line shared by all River clients. */
public final class Migrator {
private static final List<String> NAMES = Sql.resource("migration/index.txt").lines().toList();
public static final int LATEST = NAMES.size();
Expand Down
2 changes: 1 addition & 1 deletion java/river/src/main/java/com/riverqueue/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default Optional<ZonedDateTime> next(ZonedDateTime after) {
return next(after.toOffsetDateTime()).map(next -> next.atZoneSameInstant(after.getZone()));
}

/** Parses River Go's five-field cron syntax, including descriptors and time zones. */
/** Parses River's five-field cron syntax, including descriptors and time zones. */
static Schedule cron(String expression) {
return new CronSchedule(expression);
}
Expand Down
2 changes: 1 addition & 1 deletion java/river/src/main/java/com/riverqueue/Workers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ public Event(EventKind kind, Job<JsonNode> job) {
}
}

/** Event names shared with Go and the conformance protocol. */
/** Event names shared with other River clients and the conformance protocol. */
public enum EventKind {
JOB_CANCELLED,
JOB_COMPLETED,
Expand Down
22 changes: 11 additions & 11 deletions js/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `@riverqueue/cli`

The `riverqueue` command runs River's database migrations and a throughput
benchmark, and upgrades code written for `riverqueue@0.1`. It requires
Node.js 24 or newer and mirrors the commands of River's Go CLI.
benchmark, and upgrades code written for `riverqueue@0.1`. It requires Node.js
24 or newer.

```sh
npm install --save-dev @riverqueue/cli
Expand Down Expand Up @@ -41,7 +41,7 @@ Other common flags:
- `--dry-run` and `--show-sql`: print what would run, with its SQL.
- `--statement-timeout DURATION`: Postgres's `statement_timeout`, such as
`30s` or `5m`. It defaults to a `statement_timeout` parameter in the URL,
and otherwise to 10 seconds, as in River's Go CLI.
and otherwise to 10 seconds.

```sh
# Check in CI that a database is migrated.
Expand Down Expand Up @@ -102,11 +102,11 @@ backlog, so it reflects queue depth as much as per-job latency. The command
fails if running jobs or pending completions exceed their configured limits,
or if the pool exceeds `--max-connections`.

The default workload matches River's Go and Rust benchmarks so results are
comparable: a 75,000-job backlog topped up in batches of 5,000 and 2,000
concurrent workers. The pool defaults to 50 connections. `--backlog`,
`--batch-size`, `--max-workers`, `--max-connections`, and `--skip-vacuum`
change the workload for controlled comparisons.
The default workload matches the benchmarks of River's other implementations so
results are comparable: a 75,000-job backlog topped up in batches of 5,000 and
2,000 concurrent workers. The pool defaults to 50 connections. `--backlog`,
`--batch-size`, `--max-workers`, `--max-connections`, and `--skip-vacuum` change
the workload for controlled comparisons.

## Running from code

Expand All @@ -122,9 +122,9 @@ process.exitCode = await run([
]);
```

Extension packages can embed this CLI and add migration lines, as with
River's Go CLI. The migration commands select an added line with
`--line NAME`, while River's `main` line stays the default:
Extension packages can embed this CLI and add migration lines. The migration
commands select an added line with `--line NAME`, while River's `main` line
stays the default:

```ts
import type { Migration, MigrationBackend } from "@riverqueue/migrate";
Expand Down
2 changes: 1 addition & 1 deletion js/cli/etc/cli.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export declare function run(
* Options for {@link run}. Each stream defaults to the process's own.
*
* A package that ships its own migration line can embed this command line
* with its lines added, as River's Go CLI allows:
* with its lines added:
*
* ```ts
* import { run } from "@riverqueue/cli";
Expand Down
4 changes: 2 additions & 2 deletions js/cli/src/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fixed number of jobs first and stops once all of them are worked.

Every two seconds it prints the jobs worked and inserted and jobs per second.
The summary adds the overall rate, the 95th percentile time from insert to
completion, and peak resource use. The workload matches River's Go and Rust
benchmarks so results are comparable.`,
completion, and peak resource use. The workload matches the benchmarks of
River's other implementations so results are comparable.`,
name: "bench",
options: {
backlog: {
Expand Down
2 changes: 1 addition & 1 deletion js/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { formatHelp, parseOptions, UsageError } from "./options.js";
* Options for {@link run}. Each stream defaults to the process's own.
*
* A package that ships its own migration line can embed this command line
* with its lines added, as River's Go CLI allows:
* with its lines added:
*
* ```ts
* import { run } from "@riverqueue/cli";
Expand Down
Loading
Loading