File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 3131package com .rabbitmq .client ;
3232
3333import 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
Original file line number Diff line number Diff 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 (),
You can’t perform that action at this time.
0 commit comments