Skip to content

Commit e76d8a2

Browse files
author
Matthew Sackman
committed
Merging bug 21939 into default
2 parents 17655c8 + f21647d commit e76d8a2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/com/rabbitmq/client/Connection.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
package com.rabbitmq.client;
3232

3333
import java.io.IOException;
34+
import java.util.Map;
3435

3536
/**
3637
* Public API: Interface to an AMQ connection. See the see the <a href="http://www.amqp.org/">spec</a> for details.
@@ -95,6 +96,12 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
9596
*/
9697
Address[] getKnownHosts();
9798

99+
/**
100+
* Retrieve the server properties.
101+
* @return a map of the server properties. This typically includes the product name and version of the server.
102+
*/
103+
Map<String, Object> getServerProperties();
104+
98105
/**
99106
* Create a new channel, using an internally allocated channel number.
100107
* @return a new channel descriptor, or null if none is available

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ public void ensureIsOpen()
147147
private final String _username, _password, _virtualHost;
148148
private final int _requestedChannelMax, _requestedFrameMax, _requestedHeartbeat;
149149

150+
/** Saved server properties field from connection.start */
151+
public Map<String, Object> _serverProperties;
152+
150153
/** {@inheritDoc} */
151154
public String getHost() {
152155
return _frameHandler.getHost();
@@ -166,6 +169,11 @@ public FrameHandler getFrameHandler(){
166169
return _frameHandler;
167170
}
168171

172+
/** {@inheritDoc} */
173+
public Map<String, Object> getServerProperties() {
174+
return _serverProperties;
175+
}
176+
169177
/**
170178
* Construct a new connection to a broker.
171179
* @param factory the initialization parameters for a connection
@@ -243,6 +251,8 @@ public void start(boolean insist)
243251
try {
244252
AMQP.Connection.Start connStart =
245253
(AMQP.Connection.Start) connStartBlocker.getReply().getMethod();
254+
255+
_serverProperties = connStart.getServerProperties();
246256

247257
Version serverVersion =
248258
new Version(connStart.getVersionMajor(),

0 commit comments

Comments
 (0)