Skip to content

Commit fb87dd6

Browse files
committed
Log warning if the broker is not RabbitMQ
1 parent e6ddf2b commit fb87dd6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/com/rabbitmq/client/amqp/impl/AmqpConnection.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ private NativeConnectionWrapper connect(
270270
LOGGER.debug("Created native connection instance for '{}'", this.name());
271271
ExceptionUtils.wrapGet(connection.openFuture());
272272
LOGGER.debug("Connection attempt '{}' succeeded", this.name());
273+
checkBroker(connection);
273274
checkBrokerVersion(connection);
274275
return new NativeConnectionWrapper(connection, extractNode(connection), address);
275276
} catch (ClientException e) {
@@ -285,6 +286,13 @@ private void sync(NativeConnectionWrapper wrapper) {
285286
this.nativeConnection = wrapper.connection();
286287
}
287288

289+
private static void checkBroker(org.apache.qpid.protonj2.client.Connection connection) throws ClientException {
290+
String broker = (String) connection.properties().get("product");
291+
if (!"rabbitmq".equalsIgnoreCase(broker)) {
292+
LOGGER.warn("Connected to another broker than RabbitMQ ('{}'), the library may not behave as expected", broker);
293+
}
294+
}
295+
288296
private static void checkBrokerVersion(org.apache.qpid.protonj2.client.Connection connection)
289297
throws ClientException {
290298
String version = (String) connection.properties().get("version");

0 commit comments

Comments
 (0)