Adapt to CommandProcessor.handle() returning CompletableFuture<Boolean>

PubSubMessageProcessor.handle() is updated to return
CompletableFuture<Boolean>, propagating the future from
CommandProcessor.handle() to the caller.

MessageReceiverProvider chains thenAccept/exceptionally on the future
so that the Pub/Sub message is acked or nacked only after processing
truly completes, fixing a race condition where a message could be acked
before an async index operation finished.

This fixes premature Pub/Sub ack for forwarded index commands

Change-Id: I426a2723f926f4fe16ef6b168e81e55c49f10b3d
4 files changed
tree: e2b3792ddf658df3bdf2ba33b882edfaa5316e67
  1. src/
  2. .bazelversion
  3. BUILD
  4. external_plugin_deps.MODULE.bazel
  5. high-availability-gcp_plugin_deps.lock.json
  6. high-availability-gcp_third_party_runtime_jars.allowlist.txt
  7. LICENSE
  8. MODULE.bazel
  9. MODULE.bazel.lock
  10. README.md
README.md

Google GCP pubsub messaging for the Gerrit's high-availability plugin

This plugin provides an extension of the Gerrit's high-availability plugin: it provides GCP pubsub based message forwarding.

License

This plugin is released under the same Apache 2.0 license and copyright holders as of the Gerrit Code Review project.

How to build

Refer to the build instructions in the plugin documentation.

Installation

Install

  • the high-availability-gcp plugin in the Gerrit site's plugins folder.

Sample configuration

This is a minimal configuration:

[pubsub]
  projectId = my-gcp-project
  privateKeyLocation = /path/to/private/key/my-gcp-project-6f0d80a3f655.json

A complete set of configuration options is given in the following example. The example values given here are also the default values:

[pubsub]
  projectId = my-gcp-project
  privateKeyLocation = /path/to/private/key/my-gcp-project-6f0d80a3f655.json
[pubsub "topics"]
  main = default
  streamEvents = stream-events
[pubsub "limits"]
  subscriptionTimeout = 10s
  shutdownTimeout = 10s
  publisherThreadPoolSize = 4
  subscriberThreadPoolSize = 4
[pubsub "retention"]
  ackDeadline = 10s
  messageRetentionDuration = 7d
  retainAckedMessages = false
[pubsub "retry"]
  maxDeliveryAttempts = 5
  minimumBackoff = 10s
  maximumBackoff = 10m