Skip to content

Integration client - #646

Open
slinkydeveloper wants to merge 17 commits into
mainfrom
integration-client
Open

Integration client#646
slinkydeveloper wants to merge 17 commits into
mainfrom
integration-client

Conversation

@slinkydeveloper

@slinkydeveloper slinkydeveloper commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Examples

At-least-once producer

send admits each invocation into a byte-bounded local buffer, waiting up to the configured
maxBlockTime for capacity. The returned future represents durable acknowledgement.

try (IntegrationClient client = IntegrationClient.builder("http://localhost:8080").build();
    Producer producer = client.newProducer()) {
  for (byte[] payload : payloads) {
    producer.send(Invocation.create().setBody(payload));
  }

  // close() does not flush, so wait for durability before leaving the resource scope.
  producer.flush();
}

If capacity remains unavailable until maxBlockTime, send throws
ProducerBufferExhaustedException. Set maxBlockTime to Duration.ZERO for immediate failure.

Non-blocking admission

Event-loop callers can use trySend; backpressure is an explicit result and rejected attempts do
not consume an offset.

static CompletableFuture<SendResult> sendWithoutBlocking(
    Producer producer, Invocation invocation, Executor eventLoop) {
  SendAttempt attempt = producer.trySend(invocation);
  if (attempt instanceof SendAttempt.Accepted accepted) {
    return accepted.acknowledgement();
  }

  SendAttempt.Backpressured backpressured = (SendAttempt.Backpressured) attempt;
  return backpressured.ready().thenComposeAsync(
      ignored -> sendWithoutBlocking(producer, invocation, eventLoop), eventLoop);
}

Exactly-once producer

try (ExactlyOnceProducer producer = client.newExactlyOnceProducer(producerId)) {
  producer.send(lsn, Invocation.create().setBody(payload));

  long committed = producer.flush();
  checkpoint.store(committed);
}

Use flushAsync() instead when the caller must not block, and await it before closing the producer.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Test Results

  8 files  ±0    8 suites  ±0   3m 16s ⏱️ -11s
 60 tests ±0   60 ✅ ±0  0 💤 ±0  0 ❌ ±0 
267 runs  ±0  267 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit ecae875. ± Comparison against base commit 616a9de.

♻️ This comment has been updated with latest results.

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