Skip to content

Conversation

@CassioGangrel
Copy link

@CassioGangrel CassioGangrel commented Dec 24, 2025

Summary

  • Add shared-connection-name support to reuse a single RabbitMQ connection across channels.
  • Preserve incoming event-loop context even when a shared connection is created by outgoing first.
  • Add a fingerprint check so channels using the same shared-connection-name must have identical connection settings.
  • Add/adjust tests for shared connections and context.

Configuration

Example:

mp.messaging.incoming.data.shared-connection-name=shared-connection
mp.messaging.outgoing.sink.shared-connection-name=shared-connection

If two channels share the same name but have different connection settings, startup fails with:
Shared connection '<name>' has mismatched configuration...

Breaking changes / Documentation

  • No breaking changes (feature is opt-in).
  • Suggest documenting shared-connection-name and the config mismatch guard.
  • Testing ./mvnw -pl smallrye-reactive-messaging-rabbitmq -DskipITs test

Simple flowchart:

flowchart TD
  IN[Incoming channel] -->|shared-connection-name| CONN[RabbitMQConnector]
  OUT[Outgoing channel] -->|shared-connection-name| CONN

  CONN -->|getClientHolder| POOL[sharedClients by name]
  POOL -->|compute fingerprint| FP[compare or create]

  FP -->|ok| CLIENT[(RabbitMQClient shared)]
  FP -->|mismatch| ERR[fail startup]

  CLIENT --> INCTX[Incoming event-loop context]
  CLIENT --> OUTCTX[Outgoing caller context]
  CLIENT --> MET[metrics/connection name using shared label]
Loading

Fixes #3189

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.

[smallrye-rabbitmq] Proposal/Question: Allow Multiple Channels to Share a Single RabbitMQ Connection

1 participant