mirror of https://github.com/apache/activemq.git
provide server information in connection properties.
This commit is contained in:
parent
151e25117b
commit
c2310391b9
|
@ -54,6 +54,9 @@ public class AmqpSupport {
|
|||
public static final Symbol QUEUE_PREFIX = Symbol.valueOf("queue-prefix");
|
||||
public static final Symbol TOPIC_PREFIX = Symbol.valueOf("topic-prefix");
|
||||
public static final Symbol CONNECTION_OPEN_FAILED = Symbol.valueOf("amqp:connection-establishment-failed");
|
||||
public static final Symbol PRODUCT = Symbol.valueOf("product");
|
||||
public static final Symbol VERSION = Symbol.valueOf("version");
|
||||
public static final Symbol PLATFORM = Symbol.valueOf("platform");
|
||||
|
||||
// Symbols used in configuration of newly opened links.
|
||||
public static final Symbol COPY = Symbol.getSymbol("copy");
|
||||
|
|
|
@ -20,13 +20,19 @@ import static org.apache.activemq.transport.amqp.AmqpSupport.ANONYMOUS_RELAY;
|
|||
import static org.apache.activemq.transport.amqp.AmqpSupport.CONNECTION_OPEN_FAILED;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.CONTAINER_ID;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.INVALID_FIELD;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.PLATFORM;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.PRODUCT;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.QUEUE_PREFIX;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_QUEUE_CAPABILITY;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.TEMP_TOPIC_CAPABILITY;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.TOPIC_PREFIX;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.VERSION;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.contains;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -102,6 +108,25 @@ public class AmqpConnection implements AmqpProtocolConverter {
|
|||
private static final Logger TRACE_FRAMES = AmqpTransportFilter.TRACE_FRAMES;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AmqpConnection.class);
|
||||
private static final int CHANNEL_MAX = 32767;
|
||||
private static final String BROKER_VERSION;
|
||||
private static final String BROKER_PLATFORM;
|
||||
|
||||
static {
|
||||
String javaVersion = System.getProperty("java.version");
|
||||
|
||||
BROKER_PLATFORM = "Java/" + (javaVersion == null ? "unknown" : javaVersion);
|
||||
|
||||
InputStream in = null;
|
||||
String version = "5.12.0";
|
||||
if ((in = AmqpConnection.class.getResourceAsStream("/org/apache/activemq/version.txt")) != null) {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
try {
|
||||
version = reader.readLine();
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
BROKER_VERSION = version;
|
||||
}
|
||||
|
||||
private final Transport protonTransport = Proton.transport();
|
||||
private final Connection protonConnection = Proton.connection();
|
||||
|
@ -170,6 +195,9 @@ public class AmqpConnection implements AmqpProtocolConverter {
|
|||
|
||||
properties.put(QUEUE_PREFIX, "queue://");
|
||||
properties.put(TOPIC_PREFIX, "topic://");
|
||||
properties.put(PRODUCT, "ActiveMQ");
|
||||
properties.put(VERSION, BROKER_VERSION);
|
||||
properties.put(PLATFORM, BROKER_PLATFORM);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
package org.apache.activemq.transport.amqp.interop;
|
||||
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.CONNECTION_OPEN_FAILED;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.PLATFORM;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.PRODUCT;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.VERSION;
|
||||
import static org.apache.activemq.transport.amqp.AmqpSupport.contains;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -81,6 +84,20 @@ public class AmqpConnectionsTest extends AmqpClientTestSupport {
|
|||
if (!properties.containsKey(TOPIC_PREFIX)) {
|
||||
markAsInvalid("Broker did not send a queue prefix value");
|
||||
}
|
||||
|
||||
if (!properties.containsKey(PRODUCT)) {
|
||||
markAsInvalid("Broker did not send a queue product name value");
|
||||
}
|
||||
|
||||
if (!properties.containsKey(VERSION)) {
|
||||
markAsInvalid("Broker did not send a queue version value");
|
||||
}
|
||||
|
||||
if (!properties.containsKey(PLATFORM)) {
|
||||
markAsInvalid("Broker did not send a queue platform name value");
|
||||
} else {
|
||||
LOG.info("Broker platform = {}", properties.get(PLATFORM));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue