Skip to content

Commit d2175ac

Browse files
committed
Add core federation and broker connections to the management console
1 parent c49e91c commit d2175ac

File tree

25 files changed

+1226
-18
lines changed

25 files changed

+1226
-18
lines changed

artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java

+57
Original file line numberDiff line numberDiff line change
@@ -2744,4 +2744,61 @@ static void getAuthorizationFailureCount(Object source) {
27442744

27452745
@LogMessage(id = 601781, value = "User {} is getting authorization failure count on target resource: {}", level = LogMessage.Level.INFO)
27462746
void getAuthorizationFailureCount(String user, Object source);
2747+
2748+
static void startFederation(Object source) {
2749+
BASE_LOGGER.startFederation(getCaller(), source);
2750+
}
2751+
2752+
@LogMessage(id = 601782, value = "User {} is starting a federation on target resource: {}", level = LogMessage.Level.INFO)
2753+
void startFederation(String user, Object source);
2754+
2755+
static void stopFederation(Object source) {
2756+
BASE_LOGGER.stopFederation(getCaller(), source);
2757+
}
2758+
2759+
@LogMessage(id = 601783, value = "User {} is stopping a federation on target resource: {}", level = LogMessage.Level.INFO)
2760+
void stopFederation(String user, Object source);
2761+
2762+
static void isSharedConnection(Object source) {
2763+
BASE_LOGGER.isSharedConnection(getCaller(), source);
2764+
}
2765+
2766+
@LogMessage(id = 601784, value = "User {} is querying isSharedConnection on target resource: {}", level = LogMessage.Level.INFO)
2767+
void isSharedConnection(String user, Object source);
2768+
2769+
static void isPull(Object source) {
2770+
BASE_LOGGER.isPull(getCaller(), source);
2771+
}
2772+
2773+
@LogMessage(id = 601785, value = "User {} is querying isPull on target resource: {}", level = LogMessage.Level.INFO)
2774+
void isPull(String user, Object source);
2775+
2776+
static void getPriority(Object source) {
2777+
BASE_LOGGER.getPriority(getCaller(), source);
2778+
}
2779+
2780+
@LogMessage(id = 601786, value = "User {} is getting priority on target resource: {}", level = LogMessage.Level.INFO)
2781+
void getPriority(String user, Object source);
2782+
2783+
static void isOpen(Object source) {
2784+
BASE_LOGGER.isOpen(getCaller(), source);
2785+
}
2786+
2787+
@LogMessage(id = 601787, value = "User {} is querying isOpen on target resource: {}", level = LogMessage.Level.INFO)
2788+
void isOpen(String user, Object source);
2789+
2790+
static void getUri(Object source) {
2791+
BASE_LOGGER.getUri(getCaller(), source);
2792+
}
2793+
2794+
@LogMessage(id = 601788, value = "User {} is getting uri on target resource: {}", level = LogMessage.Level.INFO)
2795+
void getUri(String user, Object source);
2796+
2797+
static void getProtocol(Object source) {
2798+
BASE_LOGGER.getProtocol(getCaller(), source);
2799+
}
2800+
2801+
@LogMessage(id = 601789, value = "User {} is getting protocol on target resource: {}", level = LogMessage.Level.INFO)
2802+
void getProtocol(String user, Object source);
2803+
27472804
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.artemis.api.core.management;
18+
19+
/**
20+
* A BrokerConnectionControl is used to manage a BrokerConnections.
21+
*/
22+
public interface BrokerConnectionControl extends ActiveMQComponentControl {
23+
24+
/**
25+
* Returns {@code true} if this connection is open, {@code false} else.
26+
*/
27+
@Attribute(desc = "whether this connection is open")
28+
boolean isOpen();
29+
30+
/**
31+
* Returns the name of this broker connection
32+
*/
33+
@Attribute(desc = "name of this broker connection")
34+
String getName();
35+
36+
/**
37+
* Returns the connection uri for this broker connection.
38+
*/
39+
@Attribute(desc = "connection uri for this broker connection")
40+
String getUri();
41+
42+
/**
43+
* Returns the user this broker connection is using.
44+
*/
45+
@Attribute(desc = "the user this broker connection is using")
46+
String getUser();
47+
48+
/**
49+
* Returns the protocol this broker connection is using.
50+
*/
51+
@Attribute(desc = "protocol this broker connection is using")
52+
String getProtocol();
53+
54+
/**
55+
* Returns the retry interval used by this broker connection.
56+
*/
57+
@Attribute(desc = "retry interval used by this broker connection")
58+
long getRetryInterval();
59+
60+
/**
61+
* Returns the number of reconnection attempts used by this broker connection.
62+
*/
63+
@Attribute(desc = "number of reconnection attempts used by this broker connection")
64+
int getReconnectAttempts();
65+
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.artemis.api.core.management;
18+
19+
/**
20+
* A federationControl is used to manage a federation.
21+
*/
22+
public interface FederationControl extends ActiveMQComponentControl {
23+
24+
/**
25+
* Returns the name of this federation
26+
*/
27+
@Attribute(desc = "name of this federation")
28+
String getName();
29+
30+
/**
31+
* Returns the name of the user the federation is associated with.
32+
*/
33+
@Attribute(desc = "name of the user the federation is associated with")
34+
String getUser();
35+
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.artemis.api.core.management;
18+
19+
/**
20+
* A BridgeControl is used to manage a federation stream.
21+
*/
22+
public interface FederationRemoteConsumerControl {
23+
24+
/**
25+
* Returns the name of the queue that is being federated too
26+
*/
27+
@Attribute(desc = "name of the queue that is being federated too")
28+
String getQueueName();
29+
30+
/**
31+
* Returns the address this remote consumer will forward messages from.
32+
*/
33+
@Attribute(desc = "address this remote consumer will forward messages from")
34+
String getAddress();
35+
36+
/**
37+
* Returns the priority of this remote consumer will consumer messages.
38+
*/
39+
@Attribute(desc = "address this remote consumer will consumer messages")
40+
int getPriority();
41+
42+
/**
43+
* Returns the routing type associated with this address.
44+
*/
45+
@Attribute(desc = "routing type for this address")
46+
String getRoutingType();
47+
48+
/**
49+
* Returns the filter string associated with this remote consumer.
50+
*/
51+
@Attribute(desc = "filter string associated with this remote consumer")
52+
String getFilterString();
53+
54+
/**
55+
* Returns the queue filter string associated with this remote consumer.
56+
*/
57+
@Attribute(desc = "queue filter string associated with this remote consumer")
58+
String getQueueFilterString();
59+
60+
/**
61+
* Returns the fully qualified queue name associated with this remote consumer.
62+
*/
63+
// @Attribute(desc = "fully qualified queue name associated with this remote consumer")
64+
// String getFqqn();
65+
66+
/**
67+
* Returns the number of messages that have been federated for this address.
68+
*/
69+
@Attribute(desc = "number of messages that have been federated for this address")
70+
long getFederatedMessageCount();
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.artemis.api.core.management;
18+
19+
/**
20+
* A BridgeControl is used to manage a federation stream.
21+
*/
22+
public interface FederationStreamControl {
23+
24+
/**
25+
* Returns the name of this federation stream
26+
*/
27+
@Attribute(desc = "name of this federation stream")
28+
String getName();
29+
30+
/**
31+
* Returns any list of static connectors used by this federation stream
32+
*/
33+
@Attribute(desc = "list of static connectors used by this federation stream")
34+
String[] getStaticConnectors() throws Exception;
35+
36+
/**
37+
* Returns the name of the discovery group used by this federation stream.
38+
*/
39+
@Attribute(desc = "name of the discovery group used by this federation stream")
40+
String getDiscoveryGroupName();
41+
42+
/**
43+
* Returns the retry interval used by this federation stream.
44+
*/
45+
@Attribute(desc = "retry interval used by this federation stream")
46+
long getRetryInterval();
47+
48+
/**
49+
* Returns the retry interval multiplier used by this federation stream.
50+
*/
51+
@Attribute(desc = "retry interval multiplier used by this federation stream")
52+
double getRetryIntervalMultiplier();
53+
54+
/**
55+
* Returns the max retry interval used by this federation stream.
56+
*/
57+
@Attribute(desc = "max retry interval used by this federation stream")
58+
long getMaxRetryInterval();
59+
60+
/**
61+
* Returns the number of reconnection attempts used by this federation stream.
62+
*/
63+
@Attribute(desc = "number of reconnection attempts used by this federation stream")
64+
int getReconnectAttempts();
65+
66+
/**
67+
* Returns {@code true} if steam allows a shared connection, {@code false} else.
68+
*/
69+
@Attribute(desc = "whether this stream will allow the connection to be shared")
70+
boolean isSharedConnection();
71+
72+
/**
73+
* Returns {@code true} if this connection is configured to pull, {@code false} else.
74+
*/
75+
@Attribute(desc = "whether this connection is configured to pull")
76+
boolean isPull();
77+
78+
/**
79+
* Returns {@code true} the connection is configured for HA, {@code false} else.
80+
*/
81+
@Attribute(desc = "whether this connection is configured for HA")
82+
boolean isHA();
83+
84+
/**
85+
* Returns the name of the user the federation is associated with
86+
*/
87+
@Attribute(desc = "name of the user the federation is associated with")
88+
String getUser();
89+
90+
}

artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ObjectNameBuilder.java

+42
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ public ObjectName getBroadcastGroupObjectName(final String name) throws Exceptio
126126
return createObjectName("broadcast-group", name);
127127
}
128128

129+
/**
130+
* Returns the ObjectName used by BrokerConnectionControl.
131+
*
132+
* @see BrokerConnectionControl
133+
*/
134+
public ObjectName getBrokerConnectionObjectName(String name) throws Exception {
135+
return createObjectName("broker-connection", name);
136+
}
137+
129138
/**
130139
* Returns the ObjectName used by BridgeControl.
131140
*
@@ -135,6 +144,15 @@ public ObjectName getBridgeObjectName(final String name) throws Exception {
135144
return createObjectName("bridge", name);
136145
}
137146

147+
/**
148+
* Returns the ObjectName used by FederationControl.
149+
*
150+
* @see FederationControl
151+
*/
152+
public ObjectName getFederationObjectName(String name) throws Exception {
153+
return createObjectName("federation", name);
154+
}
155+
138156
/**
139157
* Returns the ObjectName used by ClusterConnectionControl.
140158
*
@@ -169,4 +187,28 @@ public ObjectName getManagementContextObjectName() throws Exception {
169187
public ObjectName getSecurityObjectName() throws Exception {
170188
return ObjectName.getInstance("hawtio:type=security,area=jmx,name=ArtemisJMXSecurity");
171189
}
190+
191+
/**
192+
* Returns the ObjectName used by FederationStreamControl.
193+
*
194+
* @see FederationStreamControl
195+
*/
196+
public ObjectName getFederationStreamObjectName(SimpleString federationName,
197+
SimpleString streamName) throws Exception {
198+
return ObjectName.getInstance(String.format("%s,component=federations,name=%s,streamName=%s", getActiveMQServerName(), ObjectName.quote(federationName.toString()), ObjectName.quote(streamName.toString().toLowerCase())));
199+
}
200+
201+
/**
202+
* Returns the ObjectName used by FederationRemoteConsumerControl.
203+
*
204+
* @see FederationRemoteConsumerControl
205+
*/
206+
public ObjectName getFederationRemoteConsumerObjectName(final SimpleString federationName,
207+
final SimpleString streamName,
208+
final SimpleString address,
209+
final SimpleString queueName,
210+
RoutingType routingType) throws Exception {
211+
return ObjectName.getInstance(String.format("%s,component=federations,name=%s,streamName=%s,address=%s,subcomponent=queues,routing-type=%s,queue=%s", getActiveMQServerName(), ObjectName.quote(federationName.toString()), ObjectName.quote(streamName.toString()), ObjectName.quote(address.toString()), ObjectName.quote(routingType.toString().toLowerCase()), ObjectName.quote(queueName.toString())));
212+
}
213+
172214
}

0 commit comments

Comments
 (0)