Skip to content

Add pause/resume logic in and host health awareness in consumers#85

Merged
Rahmeen14 merged 5 commits into
mainfrom
host-health
Jul 10, 2026
Merged

Add pause/resume logic in and host health awareness in consumers#85
Rahmeen14 merged 5 commits into
mainfrom
host-health

Conversation

@Rahmeen14

@Rahmeen14 Rahmeen14 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Problem statement

Consumers in rmqcpp keep consuming from a queue regardless of the health of the host they're running on. In environments where a host can become degraded (e.g. losing connectivity to a downstream dependency while still
connected to RabbitMQ), it's desirable for a consumer to stop taking messages off the broker until the host recovers, so that in-flight messages aren't processed on an unhealthy host and can instead be delivered to a healthy consumer.

There was previously no mechanism to pause/resume a consumer's delivery flow based on host health.

Proposed changes

This PR adds opt-in host-health awareness to consumers so they can stop pulling messages while their host is unhealthy and resume once it recovers. So messages aren't processed on a degraded host. It's driven by a periodic health check and enabled per-consumer through a new host-health configuration; when that config isn't set, behavior is completely unchanged. The change also adds metrics for health checks and consumer latency to make the behavior observable.

CI / build fixes (included in this branch)

  • Rebuilt dockerfiles/amqpprox.Dockerfile on ubuntu:24.04 with Conan 2 (the previous conanio/clang9 base was no
    longer usable).
  • Bumped cmake/conan versions accordingly.
  • Integration test fix: force_close_connections parsed amqpprox's conn print output with a regex written for the old session format. amqpprox (Add connectionName field and structured log format for sessions amqpprox#120) changed it from <id>: vhost=<vhost> to id=<id> vhost=<vhost> …; the busted Docker cache surfaced this. Updated the regex to accept both formats, and extended the post-force-close assertion timeout to match test_connect_disconnect.

Testing

  • Unit tests added/updated for HostHealthMonitor, ReceiveChannel pause/resume, ChannelMap, Connection, ConsumerConfig, and RabbitContextOptions.
  • Integration test suite (rmqperftest / rmqapitests) passing, including the previously failing test_forceful_disconnect.

Notes for reviewers

  • The pause/resume feature and the CI/test fixes are in separate commits for easier review.
  • Host-health checking runs on the connection's event loop; the check implementation is intentionally pluggable/config-driven.

@Rahmeen14 Rahmeen14 force-pushed the host-health branch 2 times, most recently from 6fbc28c to 53d6228 Compare July 1, 2026 16:59
@Rahmeen14 Rahmeen14 enabled auto-merge (squash) July 1, 2026 16:59
@Rahmeen14 Rahmeen14 changed the title Add pause/resume logic in consumers and consumer host health awareness Add pause/resume logic in and host health awareness in consumers Jul 2, 2026
@Rahmeen14 Rahmeen14 merged commit 569766e into main Jul 10, 2026
10 of 11 checks passed
@Rahmeen14 Rahmeen14 deleted the host-health branch July 10, 2026 09:52
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.

2 participants