Example usage for com.rabbitmq.client Connection getClientProperties

List of usage examples for com.rabbitmq.client Connection getClientProperties

Introduction

In this page you can find the example usage for com.rabbitmq.client Connection getClientProperties.

Prototype

Map<String, Object> getClientProperties();

Source Link

Document

Get a copy of the map of client properties sent to the server

Usage

From source file:com.springsource.insight.plugin.rabbitmqClient.AbstractRabbitMQCollectionAspect.java

License:Apache License

protected void applyConnectionData(Operation op, Connection conn) {
    String connectionUrl = null;/*from  w w w. ja va  2s.c om*/

    if (conn instanceof AMQConnection) {
        connectionUrl = conn.toString();
    } else {
        InetAddress address = conn.getAddress();
        int port = conn.getPort();

        StringBuilder sb = new StringBuilder("amqp://");
        sb.append(address.getHostAddress()).append(":").append(port);

        connectionUrl = sb.toString();
    }

    op.put("host", conn.getAddress().getHostAddress());
    op.put("port", conn.getPort());
    op.put("connectionUrl", connectionUrl);

    //try to extract server version
    String version = getVersion(conn.getServerProperties());
    op.put("serverVersion", version);

    //try to extract client version
    version = getVersion(conn.getClientProperties());
    op.put("clientVersion", version);
}