This commit is contained in:
Martyn Taylor 2017-11-29 08:52:58 +00:00
commit 4584ac6974
27 changed files with 326 additions and 85 deletions

View File

@ -379,6 +379,11 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
}
}
@Override
public String getTransportLocalAddress() {
return getTransportConnection().getLocalAddress();
}
private void doBufferReceived(final Packet packet) {
if (ChannelImpl.invokeInterceptors(packet, incomingInterceptors, this) != null) {
return;

View File

@ -232,4 +232,14 @@ public interface RemotingConnection extends BufferHandler {
* @return
*/
String getClientID();
/**
* Returns a string representation of the local address this connection is connected to.
* This is useful when the server is configured at 0.0.0.0 (or multiple IPs).
* This will give you the actual IP that's being used.
*
* @return the local address of transport connection
*/
String getTransportLocalAddress();
}

View File

@ -49,12 +49,14 @@ var ARTEMIS = (function(ARTEMIS) {
{
field: 'routingTypes',
displayName: 'Routing Types',
width: '*'
width: '*',
sortable: false
},
{
field: 'queueCount',
displayName: 'Queue Count',
width: '*'
width: '*',
sortable: false
}
];
$scope.filter = {
@ -107,8 +109,9 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
$scope.sortOptions = {
fields: ["id"],
columns: ["id"],
directions: ["asc"]
};
var refreshed = false;
@ -148,8 +151,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listConnections(java.lang.String, int, int)';
var attributes = [
{
field: 'connectionID',
field: 'iD',
displayName: 'ID',
width: '*'
},
@ -46,7 +46,7 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
field: 'protocol',
field: 'protocolName',
displayName: 'Protocol',
width: '*'
},
@ -55,6 +55,7 @@ var ARTEMIS = (function(ARTEMIS) {
displayName: 'Session Count',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectSessions(row)">{{row.entity.sessionCount}}</a></div>',
sortable: false
},
{
field: 'remoteAddress',
@ -62,7 +63,7 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
field: 'localAddress',
field: 'transportLocalAddress',
displayName: 'Local Address',
width: '*'
},
@ -94,7 +95,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
sortBy: "CONNECTION_ID"
sortBy: "iD"
}
};
@ -140,8 +141,9 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
$scope.sortOptions = {
fields: ["iD"],
columns: ["iD"],
directions: ["asc"]
};
var refreshed = false;
@ -181,8 +183,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -31,31 +31,31 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listConsumers(java.lang.String, int, int)';
var attributes = [
{
field: 'id',
field: 'sequentialID',
displayName: 'ID',
width: '*'
},
{
field: 'session',
field: 'sessionName',
displayName: 'Session',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.session}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.sessionName}}</a></div>'
},
{
field: 'clientID',
field: 'connectionClientID',
displayName: 'Client ID',
width: '*'
},
{
field: 'protocol',
field: 'connectionProtocolName',
displayName: 'Protocol',
width: '*'
},
{
field: 'queue',
field: 'queueName',
displayName: 'Queue',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectQueue(row)">{{row.entity.queue}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectQueue(row)">{{row.entity.queueName}}</a></div>'
},
{
field: 'queueType',
@ -63,18 +63,18 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
field: 'address',
field: 'queueAddress',
displayName: 'Address',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.address}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.queueAddress}}</a></div>'
},
{
field: 'remoteAddress',
field: 'connectionRemoteAddress',
displayName: 'Remote Address',
width: '*'
},
{
field: 'localAddress',
field: 'connectionLocalAddress',
displayName: 'Local Address',
width: '*'
},
@ -105,7 +105,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
sortBy: "ID"
sortBy: "sequentialID"
}
};
@ -165,8 +165,9 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
$scope.sortOptions = {
fields: ["sequentialID"],
columns: ["sequentialID"],
directions: ["asc"]
};
var refreshed = false;
@ -206,8 +207,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listProducers(java.lang.String, int, int)';
var attributes = [
{
field: 'id',
field: 'iD',
displayName: 'ID',
width: '*'
},
@ -39,22 +39,26 @@ var ARTEMIS = (function(ARTEMIS) {
field: 'session',
displayName: 'Session',
width: '*',
sortable: false,
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.session}}</a></div>'
},
{
field: 'clientID',
displayName: 'Client ID',
sortable: false,
width: '*'
},
{
field: 'protocol',
displayName: 'Protocol',
width: '*'
width: '*',
sortable: false
},
{
field: 'user',
displayName: 'User',
width: '*'
width: '*',
sortable: false
},
{
field: 'address',
@ -65,12 +69,14 @@ var ARTEMIS = (function(ARTEMIS) {
{
field: 'remoteAddress',
displayName: 'Remote Address',
width: '*'
width: '*',
sortable: false
},
{
field: 'localAddress',
displayName: 'Local Address',
width: '*'
width: '*',
sortable: false
}
];
$scope.filter = {
@ -93,7 +99,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
sortBy: "ID"
sortBy: "iD"
}
};
@ -129,8 +135,9 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
$scope.sortOptions = {
fields: ["iD"],
columns: ["iD"],
directions: ["asc"]
};
var refreshed = false;
@ -170,8 +177,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -37,7 +37,7 @@ var ARTEMIS = (function(ARTEMIS) {
cellTemplate: '<div class="ngCellText"><a ng-click="navigateToQueueAtts(row)">attributes</a>&nbsp;<a ng-click="navigateToQueueOps(row)">operations</a></div>'
},
{
field: 'id',
field: 'iD',
displayName: 'ID',
width: '*'
},
@ -178,7 +178,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
sortBy: "ID"
sortBy: "iD"
}
};
@ -209,10 +209,11 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
directions: ["asc"]
};
$scope.sortOptions = {
fields: ["iD"],
columns: ["iD"],
directions: ["asc"]
};
var refreshed = false;
$scope.gridOptions = {
@ -250,8 +251,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listSessions(java.lang.String, int, int)';
var attributes = [
{
field: 'id',
field: 'name',
displayName: 'ID',
width: '*'
},
@ -42,7 +42,7 @@ var ARTEMIS = (function(ARTEMIS) {
cellTemplate: '<div class="ngCellText"><a ng-click="selectConnection(row)">{{row.entity.connectionID}}</a></div>'
},
{
field: 'user',
field: 'username',
displayName: 'User',
width: '*'
},
@ -86,7 +86,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
sortBy: "ID"
sortBy: "name"
}
};
// Configure Parent/Child click through relationships
@ -160,8 +160,9 @@ var ARTEMIS = (function(ARTEMIS) {
pageSize: 100,
currentPage: 1
};
$scope.sort = {
fields: ["ID"],
$scope.sortOptions = {
fields: ["name"],
columns: ["name"],
directions: ["asc"]
};
var refreshed = false;
@ -201,8 +202,9 @@ var ARTEMIS = (function(ARTEMIS) {
$scope.loadTable();
};
$scope.loadTable = function () {
$scope.filter.values.sortColumn = $scope.sort.fields[0];
$scope.filter.values.sortBy = $scope.sort.directions[0];
$scope.filter.values.sortColumn = $scope.sortOptions.fields[0];
$scope.filter.values.sortBy = $scope.sortOptions.directions[0];
$scope.filter.values.sortOrder = $scope.sortOptions.directions[0];
var mbean = getBrokerMBean(jolokia);
if (mbean) {
var filter = JSON.stringify($scope.filter.values);

View File

@ -179,4 +179,10 @@ public class ActiveMQProtonRemotingConnection extends AbstractRemotingConnection
public void open() {
amqpConnection.open();
}
@Override
public String getTransportLocalAddress() {
return getTransportConnection().getLocalAddress();
}
}

View File

@ -266,4 +266,10 @@ public class MQTTConnection implements RemotingConnection {
public String getClientID() {
return clientID;
}
@Override
public String getTransportLocalAddress() {
return getTransportConnection().getLocalAddress();
}
}

View File

@ -1634,4 +1634,10 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
public String getClientID() {
return context.getClientId();
}
@Override
public String getTransportLocalAddress() {
return getTransportConnection().getLocalAddress();
}
}

View File

@ -798,4 +798,11 @@ public final class StompConnection implements RemotingConnection {
public String getProtocolName() {
return StompProtocolManagerFactory.STOMP_PROTOCOL_NAME;
}
@Override
public String getTransportLocalAddress() {
// TODO Auto-generated method stub
return getTransportConnection().getLocalAddress();
}
}

View File

@ -1733,12 +1733,15 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
@Override
public String listAddresses(String options, int page, int pageSize) throws Exception {
checkStarted();
clearIO();
try {
final Set<SimpleString> addresses = server.getPostOffice().getAddresses();
List<AddressInfo> addressInfo = new ArrayList<>();
for (SimpleString address:addresses) {
addressInfo.add(server.getPostOffice().getAddressInfo(address));
}
AddressView view = new AddressView(server);
view.setCollection(addresses);
view.setCollection(addressInfo);
view.setOptions(options);
return view.getResultsAsJson(page, pageSize);
} finally {

View File

@ -39,6 +39,10 @@ public abstract class ActiveMQAbstractView<T> {
private static final String FILTER_VALUE = "value";
private static final String SORT_ORDER = "sortOrder";
private static final String SORT_COLUMN = "sortColumn";
protected Collection<T> collection;
protected ActiveMQFilterPredicate<T> predicate;
@ -146,6 +150,10 @@ public abstract class ActiveMQAbstractView<T> {
predicate.setField(json.getString(FILTER_FIELD));
predicate.setOperation(json.getString(FILTER_OPERATION));
predicate.setValue(json.getString(FILTER_VALUE));
if (json.containsKey(SORT_COLUMN) && json.containsKey(SORT_ORDER)) {
this.sortColumn = json.getString(SORT_COLUMN);
this.sortOrder = json.getString(SORT_ORDER);
}
}
}

View File

@ -17,16 +17,14 @@
package org.apache.activemq.artemis.core.management.impl.view;
import javax.json.JsonObjectBuilder;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.management.impl.view.predicate.AddressFilterPredicate;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.utils.JsonLoader;
public class AddressView extends ActiveMQAbstractView<SimpleString> {
public class AddressView extends ActiveMQAbstractView<AddressInfo> {
private static final String defaultSortColumn = "creationTime";
private static final String defaultSortColumn = "id";
private final ActiveMQServer server;
@ -42,14 +40,11 @@ public class AddressView extends ActiveMQAbstractView<SimpleString> {
}
@Override
public JsonObjectBuilder toJson(SimpleString addressName) {
AddressInfo address = server.getAddressInfo(addressName);
// the address could have been removed since the list was created
// if it is not there, just ignore.
public JsonObjectBuilder toJson(AddressInfo address) {
if (address == null) {
return null;
}
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(address.getId())).add("name", toString(address.getName())).add("routingTypes", toString(address.getRoutingTypes()));
try {

View File

@ -31,7 +31,7 @@ import org.apache.activemq.artemis.utils.StringUtil;
public class ConnectionView extends ActiveMQAbstractView<RemotingConnection> {
private static final String defaultSortColumn = "creationTime";
private static final String defaultSortColumn = "iD";
private final ActiveMQServer server;
@ -57,7 +57,7 @@ public class ConnectionView extends ActiveMQAbstractView<RemotingConnection> {
users.add(username);
}
return JsonLoader.createObjectBuilder().add("connectionID", toString(connection.getID())).add("remoteAddress", toString(connection.getRemoteAddress())).add("users", StringUtil.joinStringList(users, ",")).add("creationTime", new Date(connection.getCreationTime()).toString()).add("implementation", toString(toString(connection.getClass().getSimpleName()))).add("protocol", toString(connection.getProtocolName())).add("clientID", toString(connection.getClientID())).add("localAddress", toString(connection.getTransportConnection().getLocalAddress())).add("sessionCount", server.getSessions(connection.getID().toString()).size());
return JsonLoader.createObjectBuilder().add("iD", toString(connection.getID())).add("remoteAddress", toString(connection.getRemoteAddress())).add("users", StringUtil.joinStringList(users, ",")).add("creationTime", new Date(connection.getCreationTime()).toString()).add("implementation", toString(toString(connection.getClass().getSimpleName()))).add("protocolName", toString(connection.getProtocolName())).add("clientID", toString(connection.getClientID())).add("transportLocalAddress", toString(connection.getTransportLocalAddress())).add("sessionCount", server.getSessions(connection.getID().toString()).size());
}
@Override

View File

@ -27,7 +27,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class ConsumerView extends ActiveMQAbstractView<ServerConsumer> {
private static final String defaultSortColumn = "creationTime";
private static final String defaultSortColumn = "sequentialID";
private final ActiveMQServer server;
@ -45,7 +45,7 @@ public class ConsumerView extends ActiveMQAbstractView<ServerConsumer> {
@Override
public JsonObjectBuilder toJson(ServerConsumer consumer) {
ServerSession session = server.getSessionByID(consumer.getSessionID());
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(consumer.sequentialID())).add("session", toString(session.getName())).add("clientID", toString(session.getRemotingConnection().getClientID())).add("user", toString(session.getUsername())).add("protocol", toString(session.getRemotingConnection().getProtocolName())).add("queue", toString(consumer.getQueue().getName())).add("queueType", toString(consumer.getQueue().getRoutingType()).toLowerCase()).add("address", toString(consumer.getQueue().getAddress().toString())).add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress())).add("remoteAddress", toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress())).add("creationTime", new Date(consumer.getCreationTime()).toString());
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("sequentialID", toString(consumer.getSequentialID())).add("sessionName", toString(consumer.getSessionName())).add("connectionClientID", toString(consumer.getConnectionClientID())).add("user", toString(session.getUsername())).add("connectionProtocolName", toString(consumer.getConnectionProtocolName())).add("queueName", toString(consumer.getQueueName())).add("queueType", toString(consumer.getQueueType()).toLowerCase()).add("queueAddress", toString(consumer.getQueueAddress().toString())).add("connectionLocalAddress", toString(consumer.getConnectionLocalAddress())).add("connectionRemoteAddress", toString(consumer.getConnectionRemoteAddress())).add("creationTime", new Date(consumer.getCreationTime()).toString());
return obj;
}

View File

@ -44,7 +44,7 @@ public class ProducerView extends ActiveMQAbstractView<ServerProducer> {
@Override
public JsonObjectBuilder toJson(ServerProducer producer) {
ServerSession session = server.getSessionByID(producer.getSessionID());
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(producer.getID())).add("session", toString(session.getName())).add("clientID", toString(session.getRemotingConnection().getClientID())).add("user", toString(session.getUsername())).add("protocol", toString(session.getRemotingConnection().getProtocolName())).add("address", toString(producer.getAddress() != null ? producer.getAddress() : session.getDefaultAddress())).add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress())).add("remoteAddress", toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress())).add("creationTime", toString(producer.getCreationTime()));
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("iD", toString(producer.getID())).add("session", toString(session.getName())).add("clientID", toString(session.getRemotingConnection().getClientID())).add("user", toString(session.getUsername())).add("protocol", toString(session.getRemotingConnection().getProtocolName())).add("address", toString(producer.getAddress() != null ? producer.getAddress() : session.getDefaultAddress())).add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress())).add("remoteAddress", toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress())).add("creationTime", toString(producer.getCreationTime()));
return obj;
}

View File

@ -45,7 +45,7 @@ public class QueueView extends ActiveMQAbstractView<QueueControl> {
@Override
public JsonObjectBuilder toJson(QueueControl queue) {
Queue q = server.locateQueue(new SimpleString(queue.getName()));
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(queue.getID())).add("name", toString(queue.getName())).add("address", toString(queue.getAddress())).add("filter", toString(queue.getFilter())).add("rate", toString(q.getRate())).add("durable", toString(queue.isDurable())).add("paused", toString(q.isPaused())).add("temporary", toString(queue.isTemporary())).add("purgeOnNoConsumers", toString(queue.isPurgeOnNoConsumers())).add("consumerCount", toString(queue.getConsumerCount())).add("maxConsumers", toString(queue.getMaxConsumers())).add("autoCreated", toString(q.isAutoCreated())).add("user", toString(q.getUser())).add("routingType", toString(queue.getRoutingType())).add("messagesAdded", toString(queue.getMessagesAdded())).add("messageCount", toString(queue.getMessageCount())).add("messagesAcked", toString(queue.getMessagesAcknowledged())).add("deliveringCount", toString(queue.getDeliveringCount())).add("messagesKilled", toString(queue.getMessagesKilled())).add("deliverDeliver", toString(q.isDirectDeliver()));
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("iD", toString(queue.getID())).add("name", toString(queue.getName())).add("address", toString(queue.getAddress())).add("filter", toString(queue.getFilter())).add("rate", toString(q.getRate())).add("durable", toString(queue.isDurable())).add("paused", toString(q.isPaused())).add("temporary", toString(queue.isTemporary())).add("purgeOnNoConsumers", toString(queue.isPurgeOnNoConsumers())).add("consumerCount", toString(queue.getConsumerCount())).add("maxConsumers", toString(queue.getMaxConsumers())).add("autoCreated", toString(q.isAutoCreated())).add("user", toString(q.getUser())).add("routingType", toString(queue.getRoutingType())).add("messagesAdded", toString(queue.getMessagesAdded())).add("messageCount", toString(queue.getMessageCount())).add("messagesAcked", toString(queue.getMessagesAcknowledged())).add("deliveringCount", toString(queue.getDeliveringCount())).add("messagesKilled", toString(queue.getMessagesKilled())).add("deliverDeliver", toString(q.isDirectDeliver()));
return obj;
}

View File

@ -25,7 +25,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class SessionView extends ActiveMQAbstractView<ServerSession> {
private static final String defaultSortColumn = "creationTime";
private static final String defaultSortColumn = "name";
public SessionView() {
super();
@ -39,7 +39,7 @@ public class SessionView extends ActiveMQAbstractView<ServerSession> {
@Override
public JsonObjectBuilder toJson(ServerSession session) {
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(session.getName())).add("user", toString(session.getUsername())).add("creationTime", new Date(session.getCreationTime()).toString()).add("consumerCount", session.getServerConsumers().size()).add("producerCount", session.getServerProducers().size()).add("connectionID", session.getConnectionID().toString());
JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("name", toString(session.getName())).add("username", toString(session.getUsername())).add("creationTime", new Date(session.getCreationTime()).toString()).add("consumerCount", session.getConsumerCount()).add("producerCount", session.getProducerCount()).add("connectionID", session.getConnectionID().toString());
return obj;
}

View File

@ -16,11 +16,10 @@
*/
package org.apache.activemq.artemis.core.management.impl.view.predicate;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
public class AddressFilterPredicate extends ActiveMQFilterPredicate<SimpleString> {
public class AddressFilterPredicate extends ActiveMQFilterPredicate<AddressInfo> {
enum Field {
ID, NAME, ROUTING_TYPES, PRODUCER_ID, QUEUE_COUNT
@ -36,8 +35,7 @@ public class AddressFilterPredicate extends ActiveMQFilterPredicate<SimpleString
}
@Override
public boolean apply(SimpleString addressName) {
AddressInfo address = server.getAddressInfo(addressName);
public boolean apply(AddressInfo address) {
if (f == null)
return true;
try {

View File

@ -0,0 +1,63 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.server;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
public interface ConsumerInfo {
/** an unique sequential ID for this consumer */
long getSequentialID();
/** @return name of the queue that is being consumed */
SimpleString getQueueName();
/** @return name of the queue that is being consumed */
RoutingType getQueueType();
/** @return name of the queue that is being consumed */
SimpleString getQueueAddress();
String getSessionName();
String getConnectionClientID();
/**
* Returns the name of the protocol for this Remoting Connection
* @return the name of protocol
*/
String getConnectionProtocolName();
/**
* Returns a string representation of the local address this connection is
* connected to. This is useful when the server is configured at 0.0.0.0 (or
* multiple IPs). This will give you the actual IP that's being used.
*
* @return the local address
*/
String getConnectionLocalAddress();
/**
* Returns a string representation of the remote address this connection is
* connected to.
*
* @return the remote address
*/
String getConnectionRemoteAddress();
}

View File

@ -23,7 +23,7 @@ import org.apache.activemq.artemis.core.transaction.Transaction;
/**
* A ServerConsumer
*/
public interface ServerConsumer extends Consumer {
public interface ServerConsumer extends Consumer, ConsumerInfo {
void setlowConsumerDetection(SlowConsumerDetectionListener listener);
@ -107,6 +107,4 @@ public interface ServerConsumer extends Consumer {
String getSessionID();
void promptDelivery();
}
}

View File

@ -312,4 +312,8 @@ public interface ServerSession extends SecurityAuth {
Map<String, ServerProducer> getServerProducers();
String getDefaultAddress();
}
int getConsumerCount();
int getProducerCount();
}

View File

@ -1387,4 +1387,49 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
return b;
}
}
}
@Override
public long getSequentialID() {
return sequentialID;
}
@Override
public SimpleString getQueueName() {
return getQueue().getName();
}
@Override
public RoutingType getQueueType() {
return getQueue().getRoutingType();
}
@Override
public SimpleString getQueueAddress() {
return getQueue().getAddress();
}
@Override
public String getSessionName() {
return this.session.getName();
}
@Override
public String getConnectionClientID() {
return this.session.getRemotingConnection().getClientID();
}
@Override
public String getConnectionProtocolName() {
return this.session.getRemotingConnection().getProtocolName();
}
@Override
public String getConnectionLocalAddress() {
return this.session.getRemotingConnection().getTransportConnection().getLocalAddress();
}
@Override
public String getConnectionRemoteAddress() {
return this.session.getRemotingConnection().getTransportConnection().getRemoteAddress();
}
}

View File

@ -1802,4 +1802,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
public String getDefaultAddress() {
return defaultAddress != null ? defaultAddress.toString() : null;
}
}
@Override
public int getConsumerCount() {
return getServerConsumers().size();
}
@Override
public int getProducerCount() {
return getServerProducers().size();
}
}

View File

@ -18,6 +18,8 @@ package org.apache.activemq.artemis.tests.integration.cli;
import java.util.List;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.server.HandleStatus;
import org.apache.activemq.artemis.core.server.MessageReference;
@ -211,4 +213,58 @@ public class DummyServerConsumer implements ServerConsumer {
public void disconnect() {
}
@Override
public long getSequentialID() {
// TODO Auto-generated method stub
return 0;
}
@Override
public SimpleString getQueueName() {
// TODO Auto-generated method stub
return null;
}
@Override
public RoutingType getQueueType() {
// TODO Auto-generated method stub
return null;
}
@Override
public SimpleString getQueueAddress() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getSessionName() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getConnectionClientID() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getConnectionProtocolName() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getConnectionLocalAddress() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getConnectionRemoteAddress() {
// TODO Auto-generated method stub
return null;
}
}