Skip to content

Cu 868jzwene - #12

Draft
harshaellanki wants to merge 19 commits into
mainfrom
cu-868jzwene
Draft

Cu 868jzwene#12
harshaellanki wants to merge 19 commits into
mainfrom
cu-868jzwene

Conversation

@harshaellanki

Copy link
Copy Markdown
Contributor

No description provided.

TreyE and others added 9 commits August 21, 2026 14:18
Restores/adds infrastructure required so that the following cherry-picks
apply cleanly:

  - protocols/registry.rb + protocols.rb
  - protocols/base/{,channel_proxy,connection_proxy}.rb
  - protocols/arn_protocol.rb + arn/* (wholesale)
  - protocols/http/faraday_version_adapter.rb
  - helpers.rb, paginator.rb, worker_pool.rb
  - rspec/event_routing_matchers.rb
  - uris/arn_uri.rb
  - configure/server_configurations{,/*}.rb
  - realigned connection_manager.rb, connection.rb, subscriber.rb,
    channel.rb, amqp_protocol.rb, http_protocol.rb, amqp/bunny_*,
    http/faraday_*, mime_decode.rb, ruby_versions.rb, event_source.rb
  - Gemfile / event_source.gemspec / .github/workflows/rspec.yml /
    .rubocop.yml adjusted for the new baseline

DC branding preserved:
  - spec.email = info@dchbx.com
  - spec.homepage = https://github.com/dchbx/event_source
  - LICENSE.txt untouched
  - lib/event_source/version.rb untouched
Subscriber routing specs now check the routed action more carefully.
* remove pii and payload from loggers

* spec fix

* updated few loggers based on PR comments
BunnyChannelProxy#create_channel creates one confirm-enabled publisher
channel per AsyncAPI channel item, and publish operations are resolved
from a shared registry, so every thread publishing a given event reuses
one Bunny::Channel. BunnyExchangeProxy#publish then did an unsynchronized
publish-then-wait on it.

Bunny's confirm state is channel-wide, and wait_for_confirms blocks until
the channel's entire unconfirmed set drains. With N threads parked in
poll, the drain pushes one token and signals one waiter; the other N-1
stay parked until continuation_timeout elapses and Timeout::Error is
raised. Under sustained load the set may never be observed empty at all.
The HTTP subscriber path makes this concrete: FaradayChannelProxy
hardcodes 5 worker threads, each able to publish to the same exchange.

Taking the lock on the channel rather than the proxy scopes it to the
contended state, which several exchanges may share via
create_exchange_to_exchange_bindings. Channel#synchronize wraps
@publishing_mutex, a reentrant Monitor by default, which basic_publish
re-enters through Session#send_frameset; neither the reader loop that
delivers acks nor the heartbeat sender acquires it, so holding it across
the wait cannot deadlock. Verified against bunny 2.19 through 3.1.

Serializing also fixes a correctness bug: wait_for_confirms ends with
read_and_reset_only_acks_received on channel-level state, so a nack for
one thread's message could be reported to another, or consumed by the
first and lost for the second.

Timeout::Error is now re-raised as MessagePublishConfirmationError noting
the message may have been delivered, since publish returns before the
wait and the message is already on the wire. Both confirmation errors
name the exchange and routing key.

The concurrency spec fails deterministically without this change: four
of five threads raise Timeout::Error at continuation_timeout.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Adding pooling for publisher confirmation.

* removed ruby 2.0.5 support

---------

Co-authored-by: HArsHA Ellanki <h_vardhan@yahoo.com>
Comment thread .github/workflows/rspec.yml Fixed
Comment thread .github/workflows/rspec.yml Fixed
- lib/event_source/logging.rb: add EventSource::InheritedLogger class,
  referenced by subscriber.rb, publisher.rb, worker.rb, and
  runtime/worker_inventory.rb.
- spec/rails_app/config/initializers/event_source.rb: restore DC's
  initializer (prep had overwritten it with an ME version that used
  server.arn, which DC's Configure::Servers class doesn't support).
- spec/rails_app/spec/railtie_spec.rb: restore (upstream #149 deleted
  it; DC still needs it).
Remove Gemfile.lock and spec/rails_app/Gemfile.lock from version
control and add to .gitignore.
…Zeitwerk violations

- lib/event_source/configure.rb: require server_configurations so that
  EventSource::Configure::ServerConfigurations::AmqpConfiguration
  (used by bunny_connection_key.rb / bunny_connection_settings.rb)
  is defined.
- lib/event_source/configure/servers.rb: add :hosts member to
  AmqpConfiguration struct (introduced by upstream #149 multi-server
  support). DC-specific SOAP/ClientCertificate configuration
  preserved unchanged.
- spec/rails_app: fix Zeitwerk::NameError violations exposed by the
  newer zeitwerk pulled in via updated deps:
  * contracts/parties/organization/update_fein_contract.rb: nest under
    Parties::Organization
  * event_source/adapters/parties/dry_event_adapter.rb: nest under
    Adapters::Parties
  * event_source/publishers/determination_publisher.rb: nest under
    Publishers
  * event_source/publishers/parties/organization_publisher.rb: nest
    under Publishers::Parties
  * event_source/subscribers/determination_subscriber.rb: nest under
    Subscribers
…register long_running_subscriber_host

- lib/event_source/protocols/amqp/bunny_connection_key.rb: recognize
  DC's legacy EventSource::Configure::AmqpConfiguration alongside the
  newer ServerConfigurations::AmqpConfiguration in build_from_key_object.
  Previously any DC-configured AMQP server was falling through to
  build_from_hash which returns a plain URL string instead of a
  BunnyConnectionKey, causing add_connection / fetch_connection to
  register/look up under mismatched key types.
- spec/rails_app/config/initializers/event_source.rb: register the
  long_running_subscriber_host AMQP server needed by upstream #149
  test fixtures (long_running_publisher.yml / long_running_subscriber.yml).
Rails 8 freezes Engine paths after initialization, which breaks
spec/rails_app boot with FrozenError from Rails::Engine#unshift.
Keep DC on the Rails 6.x/7.x series until spec/rails_app is
adapted for Rails 8.
Rails 8 freezes Engine paths after initialization, breaking
spec/rails_app boot with FrozenError from Rails::Engine#unshift.
Rails 7.1+ additionally requires ActionController::Base to be
loaded before railties boot for the health controller.
Rails 6.1.7.10 fails on Ruby 3.2+ with a Logger constant error.
Pin to Rails 7.0.x which boots cleanly across the CI matrix.
Rails 7.0's HealthController subclasses ActionController::Base, which
must be loaded before Rails.application.initialize! completes.
Requiring action_controller/railtie makes it available without
pulling the full Rails default stack.
Ruby 3.4's JSON::GeneratorError#initialize requires 1..2 args.
`.and_raise(JSON::GeneratorError)` (no args) fell through to the
StandardError rescue instead of the JSON::GeneratorError rescue,
so the failure message was 'Unexpected error during encoding...'
rather than 'Failed to encode payload to JSON: ...'.
@harshaellanki harshaellanki added the enhancement *️⃣ New feature or request label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement *️⃣ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants