This commit is contained in:
damage 2024-09-25 21:46:49 +02:00
commit 7a2cbbf8ec
19 changed files with 969 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target
.vscode

3
bash.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker container exec -it artemis /bin/bash

32
pom.xml Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.berlin.airport.artemis</groupId>
<artifactId>tool</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.qpid/protonj2-client -->
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>protonj2-client</artifactId>
<version>1.0.0-M22</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,103 @@
package de.berlin.airport.artemis;
import java.io.IOException;
import java.util.HashMap;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import com.google.gson.Gson;
import de.berlin.airport.artemis.json.Connections;
import de.berlin.airport.artemis.json.Consumers;
import de.berlin.airport.artemis.json.Producers;
import de.berlin.airport.artemis.json.QueuePage;
import de.berlin.airport.artemis.json.Sessions;
public class JMXBroker {
private JMXConnector jmxConnector;
private MBeanServerConnection beanConnector;
private ObjectName brokerBean;
private String brokerName;
public JMXBroker(String brokerName) {
this.brokerName = brokerName;
}
public void connect(String host, int port, String username, String password) throws IOException, MalformedObjectNameException {
HashMap<String, Object> jmxEnvironment = new HashMap<String, Object>();
jmxEnvironment.put(JMXConnector.CREDENTIALS, new String[] { username, password });
JMXServiceURL url = new JMXServiceURL(String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", host, port));
jmxConnector = JMXConnectorFactory.newJMXConnector(url, jmxEnvironment);
jmxConnector.connect();
beanConnector = jmxConnector.getMBeanServerConnection();
brokerBean = new ObjectName(String.format("org.apache.activemq.artemis:broker=\"%s\"", brokerName));
}
public void disconnect() throws IOException {
jmxConnector.close();
beanConnector = null;
brokerBean = null;
}
public JMXQueue getQueueJMX(String queueName) throws MalformedObjectNameException {
return new JMXQueue(brokerBean.getCanonicalName(), queueName, beanConnector);
}
public Sessions getSessions() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
Object ret = beanConnector.invoke(brokerBean, "listAllSessionsAsJSON", null, null);
Gson gson = new Gson();
return gson.fromJson(ret.toString(), Sessions.class);
}
public Connections getConnections() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
Object ret = beanConnector.invoke(brokerBean, "listConnectionsAsJSON", null, null);
Gson gson = new Gson();
return gson.fromJson(ret.toString(), Connections.class);
}
public QueuePage getQueuesPaged(String options, int page, int size) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
Object[] parameters = new Object[3];
parameters[0] = options;
parameters[1] = page;
parameters[2] = size;
String[] signatures = new String[3];
signatures[0] = String.class.getName();
signatures[1] = int.class.getName();
signatures[2] = int.class.getName();
Object ret = beanConnector.invoke(brokerBean, "listQueues", parameters, signatures);
Gson gson = new Gson();
return gson.fromJson(ret.toString(), QueuePage.class);
}
public Consumers getConsumers(String connectionId) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
Object[] parameters = new Object[1];
parameters[0] = connectionId;
String[] signatures = new String[1];
signatures[0] = String.class.getName();
Object ret = beanConnector.invoke(brokerBean, "listConsumersAsJSON", parameters, signatures);
Gson gson = new Gson();
return gson.fromJson(ret.toString(), Consumers.class);
}
public Producers getProducers() throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
Object ret = beanConnector.invoke(brokerBean, "listProducersInfoAsJSON", null, null);
Gson gson = new Gson();
return gson.fromJson(ret.toString(), Producers.class);
}
}

View File

@ -0,0 +1,29 @@
package de.berlin.airport.artemis;
import java.io.IOException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
public class JMXQueue {
private MBeanServerConnection beanConnector;
private ObjectName queueBean;
public JMXQueue(String brokerBeanName, String queueName, MBeanServerConnection beanConnector) throws MalformedObjectNameException {
this.beanConnector = beanConnector;
this.queueBean = new ObjectName(String.format("%s,component=addresses,address=\"%s\"", brokerBeanName, queueName));
}
public void pause() throws MalformedObjectNameException, InstanceNotFoundException, MBeanException, ReflectionException, IOException {
beanConnector.invoke(queueBean, "pause", null, null);
}
public void resume() throws MalformedObjectNameException, InstanceNotFoundException, MBeanException, ReflectionException, IOException {
beanConnector.invoke(queueBean, "resume", null, null);
}
}

View File

@ -0,0 +1,169 @@
package de.berlin.airport.artemis;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MalformedObjectNameException;
import javax.management.ReflectionException;
import javax.naming.NamingException;
import org.apache.qpid.protonj2.client.Client;
import org.apache.qpid.protonj2.client.Connection;
import org.apache.qpid.protonj2.client.ConnectionOptions;
import org.apache.qpid.protonj2.client.Delivery;
import org.apache.qpid.protonj2.client.Message;
import org.apache.qpid.protonj2.client.Receiver;
import org.apache.qpid.protonj2.client.Sender;
import org.apache.qpid.protonj2.client.exceptions.ClientException;
import de.berlin.airport.artemis.json.Connections;
import de.berlin.airport.artemis.json.Consumer;
import de.berlin.airport.artemis.json.Consumers;
import de.berlin.airport.artemis.json.Producer;
import de.berlin.airport.artemis.json.Producers;
import de.berlin.airport.artemis.json.Queue;
import de.berlin.airport.artemis.json.QueuePage;
import de.berlin.airport.artemis.json.Session;
import de.berlin.airport.artemis.json.Sessions;
public class Main {
private static final String QUEUE = "foobar";
private static final String USERNAME = "artemis";
private static final String PASSWORD = "artemis";
private static final String AMQP_HOST = "localhost";
private static final String BROKER_NAME = "0.0.0.0";
private static final int AMQP_PORT = 5672;
private static final String JMX_HOST = "localhost";
private static final int JMX_PORT = 1099;
public void run() throws IOException, MalformedObjectNameException, InstanceNotFoundException, MBeanException,
ReflectionException, NamingException, ClientException {
JMXBroker jmxBroker = new JMXBroker(BROKER_NAME);
jmxBroker.connect(JMX_HOST, JMX_PORT, USERNAME, PASSWORD);
// JMXQueue jmxQueue = jmxBroker.getQueueJMX(QUEUE);
Client amqpCLient = Client.create();
ConnectionOptions ampqConnectionOptions = new ConnectionOptions();
ampqConnectionOptions.user(USERNAME);
ampqConnectionOptions.password(PASSWORD);
Connection amqpConnection = amqpCLient.connect(AMQP_HOST, AMQP_PORT, ampqConnectionOptions);
Receiver amqpReceiver = amqpConnection.openReceiver(QUEUE);
Sender amqpSender = amqpConnection.openSender(QUEUE);
amqpSender.send(Message.create("Hello baz"));
Delivery amqpDelivery = amqpReceiver.receive();
System.out.println(amqpDelivery.message().body().toString());
Connections connections = jmxBroker.getConnections();
Sessions sessions = jmxBroker.getSessions();
QueuePage queuePage = jmxBroker.getQueuesPaged(
"{\"field\":\"\",\"operation\":\"\",\"value\":\"\",\"sortOrder\":\"asc\",\"sortColumn\":\"name\"}", 1,
200);
Producers producers = jmxBroker.getProducers();
HashMap<de.berlin.airport.artemis.json.Connection, Consumers> consumersPerConnection = new HashMap<>();
for (de.berlin.airport.artemis.json.Connection connection : connections) {
consumersPerConnection.put(connection, jmxBroker.getConsumers(connection.getConnectionID()));
}
System.out.println(".==================================================.");
System.out.println("| Connections |");
System.out.println("|==================================================|");
System.out.println("| Connection ID | Client Address | #Sessions |");
System.out.println("|---------------|----------------------|-----------|");
for (de.berlin.airport.artemis.json.Connection connection : connections) {
System.out.println(String.format("| %-13s | %-20s | %9d |", connection.getConnectionID(),
connection.getClientAddress(), connection.getSessionCount()));
}
System.out.println("'=================================================='");
System.out.println(".===================================================================.");
System.out.println("| Sessions |");
System.out.println("|===================================================================|");
System.out.println("| Session ID | #Consumer | User |");
System.out.println("|--------------------------------------|-----------|----------------|");
for (Session session : sessions) {
System.out.println(String.format("| %-36s | %9d | %-14s |", session.getSessionID(),
session.getConsumerCount(), session.getValidatedUser()));
}
System.out.println("'==================================================================='");
System.out.println(
".=====================================================================================================.");
System.out.println(
"| Queues |");
System.out.println(
"|=====================================================================================================|");
System.out.println(
"| Queue ID | Address | Queue Name | #Consumer | #Message |");
System.out.println(
"|----------|----------------------------|--------------------------------------|-----------|----------|");
for (Queue queue : queuePage.getData()) {
System.out.println(String.format("| %8d | %-26s | %-36s | %9d | %8d |", queue.getId(), queue.getAddress(),
queue.getName(), queue.getConsumerCount(), queue.getMessageCount()));
}
System.out.println(
"'====================================================================================================='");
System.out.println(
".================================================================================================================.");
System.out.println(
"| Producers |");
System.out.println(
"|================================================================================================================|");
System.out.println(
"| Producer ID | Connection ID | Session ID | Destination | #MessageSent |");
System.out.println(
"|-------------|---------------|--------------------------------------|----------------------------|--------------|");
for (Producer producer : producers) {
System.out.println(String.format("| %11d | %-13s | %-36s | %-26s | %12d |", producer.getId(),
producer.getConnectionID(), producer.getSessionID(), producer.getDestination(),
producer.getMsgSent()));
}
System.out.println(
"'================================================================================================================'");
System.out.println(
".==========================================================================================================================================================.");
System.out.println(
"| Consumers |");
System.out.println(
"|==========================================================================================================================================================|");
System.out.println(
"| Connection ID | Consumer ID | Session ID | Queue Name | #MessagesDelivered | LastDeliveredTime |");
System.out.println(
"|---------------|-------------|--------------------------------------|--------------------------------------|--------------------|-------------------------|");
for (Entry<de.berlin.airport.artemis.json.Connection, Consumers> consumers : consumersPerConnection
.entrySet()) {
for (Consumer consumer : consumers.getValue()) {
System.out.println(String.format("| %-13s | %11d | %-36s | %-36s | %18d | %-23s |",
consumer.getConnectionID(),
consumer.getConsumerID(),
consumer.getSessionID(),
consumer.getQueueName(),
consumer.getMessagesDelivered(),
consumer.getLastDeliveredTimeLocal()));
}
}
System.out.println(
"'=========================================================================================================================================================='");
// System.in.read();
jmxBroker.disconnect();
amqpConnection.close();
}
public static void main(String[] args) {
try {
Main main = new Main();
main.run();
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace(System.err);
}
}
}

View File

@ -0,0 +1,22 @@
package de.berlin.airport.artemis.json;
import java.util.ArrayList;
// {"data":[{"id":"13",...,"internalQueue":"false"}],"count":3}
public class APage<T> {
private ArrayList<T> data;
private int count;
public ArrayList<T> getData() {
return data;
}
public void setData(ArrayList<T> data) {
this.data = data;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}

View File

@ -0,0 +1,43 @@
package de.berlin.airport.artemis.json;
// {"connectionID":"cf563dce","clientAddress":"172.17.0.1:40528","creationTime":1727284830242,"implementation":"ActiveMQProtonRemotingConnection","sessionCount":1}
public class Connection {
private String connectionID;
private String clientAddress;
private long creationTime;
private String implementation;
private int sessionCount;
public String getConnectionID() {
return connectionID;
}
public void setConnectionID(String connectionID) {
this.connectionID = connectionID;
}
public String getClientAddress() {
return clientAddress;
}
public void setClientAddress(String clientAddress) {
this.clientAddress = clientAddress;
}
public long getCreationTime() {
return creationTime;
}
public void setCreationTime(long creationTime) {
this.creationTime = creationTime;
}
public String getImplementation() {
return implementation;
}
public void setImplementation(String implementation) {
this.implementation = implementation;
}
public int getSessionCount() {
return sessionCount;
}
public void setSessionCount(int sessionCount) {
this.sessionCount = sessionCount;
}
}

View File

@ -0,0 +1,16 @@
package de.berlin.airport.artemis.json;
import java.util.ArrayList;
public class Connections extends ArrayList<Connection> {
public Connection getBySessionId(String connectionId) {
for (Connection connection: this) {
if (connection.getConnectionID().equals(connectionId)) {
return connection;
}
}
return null;
}
}

View File

@ -0,0 +1,138 @@
package de.berlin.airport.artemis.json;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
// {"consumerID":0,"sequentialId":976,"connectionID":"4f73bd2a","sessionID":"925a87aa-7b6e-11ef-be45-0242ac110002",
// "queueName":"9abe3fc6-c348-488e-b1d7-516bbf612fac","browseOnly":false,"creationTime":1727290030380,
// "deliveringCount":0,"messagesInTransit":0,"messagesInTransitSize":0,"messagesDelivered":1,"messagesDeliveredSize":14,
// "messagesAcknowledged":1,"messagesAcknowledgedAwaitingCommit":0,"lastDeliveredTime":1727290030384,
// "lastAcknowledgedTime":1727290030386,"status":"OK"}
public class Consumer {
private int consumerID;
private int sequentialId;
private String connectionID;
private String sessionID;
private String queueName;
private boolean browseOnly;
private long creationTime;
private int deliveringCount;
private int messagesInTransit;
private int messagesInTransitSize;
private int messagesDelivered;
private int messagesDeliveredSize;
private int messagesAcknowledged;
private int messagesAcknowledgedAwaitingCommit;
private long lastDeliveredTime;
private long lastAcknowledgedTime;
private String status;
public int getConsumerID() {
return consumerID;
}
public void setConsumerID(int consumerID) {
this.consumerID = consumerID;
}
public int getSequentialId() {
return sequentialId;
}
public void setSequentialId(int sequentialId) {
this.sequentialId = sequentialId;
}
public String getConnectionID() {
return connectionID;
}
public void setConnectionID(String connectionID) {
this.connectionID = connectionID;
}
public String getSessionID() {
return sessionID;
}
public void setSessionID(String sessionID) {
this.sessionID = sessionID;
}
public String getQueueName() {
return queueName;
}
public void setQueueName(String queueName) {
this.queueName = queueName;
}
public boolean isBrowseOnly() {
return browseOnly;
}
public void setBrowseOnly(boolean browseOnly) {
this.browseOnly = browseOnly;
}
public long getCreationTime() {
return creationTime;
}
public void setCreationTime(long creationTime) {
this.creationTime = creationTime;
}
public int getDeliveringCount() {
return deliveringCount;
}
public void setDeliveringCount(int deliveringCount) {
this.deliveringCount = deliveringCount;
}
public int getMessagesInTransit() {
return messagesInTransit;
}
public void setMessagesInTransit(int messagesInTransit) {
this.messagesInTransit = messagesInTransit;
}
public int getMessagesInTransitSize() {
return messagesInTransitSize;
}
public void setMessagesInTransitSize(int messagesInTransitSize) {
this.messagesInTransitSize = messagesInTransitSize;
}
public int getMessagesDelivered() {
return messagesDelivered;
}
public void setMessagesDelivered(int messagesDelivered) {
this.messagesDelivered = messagesDelivered;
}
public int getMessagesDeliveredSize() {
return messagesDeliveredSize;
}
public void setMessagesDeliveredSize(int messagesDeliveredSize) {
this.messagesDeliveredSize = messagesDeliveredSize;
}
public int getMessagesAcknowledged() {
return messagesAcknowledged;
}
public void setMessagesAcknowledged(int messagesAcknowledged) {
this.messagesAcknowledged = messagesAcknowledged;
}
public int getMessagesAcknowledgedAwaitingCommit() {
return messagesAcknowledgedAwaitingCommit;
}
public void setMessagesAcknowledgedAwaitingCommit(int messagesAcknowledgedAwaitingCommit) {
this.messagesAcknowledgedAwaitingCommit = messagesAcknowledgedAwaitingCommit;
}
public long getLastDeliveredTime() {
return lastDeliveredTime;
}
public void setLastDeliveredTime(long lastDeliveredTime) {
this.lastDeliveredTime = lastDeliveredTime;
}
public long getLastAcknowledgedTime() {
return lastAcknowledgedTime;
}
public void setLastAcknowledgedTime(long lastAcknowledgedTime) {
this.lastAcknowledgedTime = lastAcknowledgedTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public LocalDateTime getLastDeliveredTimeLocal() {
Instant i = Instant.ofEpochMilli(getLastDeliveredTime());
return LocalDateTime.ofInstant(i, ZoneOffset.UTC);
}
}

View File

@ -0,0 +1,7 @@
package de.berlin.airport.artemis.json;
import java.util.ArrayList;
public class Consumers extends ArrayList<Consumer> {
}

View File

@ -0,0 +1,71 @@
package de.berlin.airport.artemis.json;
// {"id":"60","name":"sender-ID:7cb0551c-6c24-4bb7-984c-16a47f836509:1:1:1:1","connectionID":"4f73bd2a",
// "sessionID":"925a87aa-7b6e-11ef-be45-0242ac110002","creationTime":"1727290030380","destination":"foobar",
// "lastProducedMessageID":null,"msgSent":1,"msgSizeSent":14}
public class Producer {
private int id;
private String name;
private String connectionID;
private String sessionID;
private long creationTime;
private String destination;
private String lastProducedMessageID;
private int msgSent;
private int msgSizeSent;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getConnectionID() {
return connectionID;
}
public void setConnectionID(String connectionID) {
this.connectionID = connectionID;
}
public String getSessionID() {
return sessionID;
}
public void setSessionID(String sessionID) {
this.sessionID = sessionID;
}
public long getCreationTime() {
return creationTime;
}
public void setCreationTime(long creationTime) {
this.creationTime = creationTime;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getLastProducedMessageID() {
return lastProducedMessageID;
}
public void setLastProducedMessageID(String lastProducedMessageID) {
this.lastProducedMessageID = lastProducedMessageID;
}
public int getMsgSent() {
return msgSent;
}
public void setMsgSent(int msgSent) {
this.msgSent = msgSent;
}
public int getMsgSizeSent() {
return msgSizeSent;
}
public void setMsgSizeSent(int msgSizeSent) {
this.msgSizeSent = msgSizeSent;
}
}

View File

@ -0,0 +1,7 @@
package de.berlin.airport.artemis.json;
import java.util.ArrayList;
public class Producers extends ArrayList<Producer> {
}

View File

@ -0,0 +1,250 @@
package de.berlin.airport.artemis.json;
// {"id":"13","name":"$sys.mqtt.sessions","address":"$sys.mqtt.sessions","filter":"",
// "durable":"true","paused":"false","temporary":"false","purgeOnNoConsumers":"false",
// "consumerCount":"0","maxConsumers":"-1","autoCreated":"false","user":"","routingType":"ANYCAST",
// "messagesAdded":"0","messageCount":"0","messagesAcked":"0","messagesExpired":"0","deliveringCount":"0",
// "messagesKilled":"0","directDeliver":"false","exclusive":"false","lastValue":"true","lastValueKey":"_AMQ_LVQ_NAME",
// "scheduledCount":"0","groupRebalance":"false","groupRebalancePauseDispatch":"false","groupBuckets":"-1",
// "groupFirstKey":"","enabled":"true","ringSize":"-1","consumersBeforeDispatch":"0","delayBeforeDispatch":"-1",
// "autoDelete":"false","internalQueue":"true"}
public class Queue {
private int id;
private String name;
private String address;
private String filter;
private boolean durable;
private boolean paused;
private boolean temporary;
private boolean purgeOnNoConsumers;
private int consumerCount;
private int maxConsumers;
private boolean autoCreated;
private String user;
private String routingType;
private int messagesAdded;
private int messageCount;
private int messagesAcked;
private int messagesExpired;
private int deliveringCount;
private int messagesKilled;
private boolean directDeliver;
private boolean exclusive;
private boolean lastValue;
private String lastValueKey;
private int scheduledCount;
private boolean groupRebalance;
private boolean groupRebalancePauseDispatch;
private int groupBuckets;
private String groupFirstKey;
private boolean enabled;
private int ringSize;
private int consumersBeforeDispatch;
private int delayBeforeDispatch;
private boolean autoDelete;
private boolean internalQueue;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getFilter() {
return filter;
}
public void setFilter(String filter) {
this.filter = filter;
}
public boolean isDurable() {
return durable;
}
public void setDurable(boolean durable) {
this.durable = durable;
}
public boolean isPaused() {
return paused;
}
public void setPaused(boolean paused) {
this.paused = paused;
}
public boolean isTemporary() {
return temporary;
}
public void setTemporary(boolean temporary) {
this.temporary = temporary;
}
public boolean isPurgeOnNoConsumers() {
return purgeOnNoConsumers;
}
public void setPurgeOnNoConsumers(boolean purgeOnNoConsumers) {
this.purgeOnNoConsumers = purgeOnNoConsumers;
}
public int getConsumerCount() {
return consumerCount;
}
public void setConsumerCount(int consumerCount) {
this.consumerCount = consumerCount;
}
public int getMaxConsumers() {
return maxConsumers;
}
public void setMaxConsumers(int maxConsumers) {
this.maxConsumers = maxConsumers;
}
public boolean isAutoCreated() {
return autoCreated;
}
public void setAutoCreated(boolean autoCreated) {
this.autoCreated = autoCreated;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getRoutingType() {
return routingType;
}
public void setRoutingType(String routingType) {
this.routingType = routingType;
}
public int getMessagesAdded() {
return messagesAdded;
}
public void setMessagesAdded(int messagesAdded) {
this.messagesAdded = messagesAdded;
}
public int getMessageCount() {
return messageCount;
}
public void setMessageCount(int messageCount) {
this.messageCount = messageCount;
}
public int getMessagesAcked() {
return messagesAcked;
}
public void setMessagesAcked(int messagesAcked) {
this.messagesAcked = messagesAcked;
}
public int getMessagesExpired() {
return messagesExpired;
}
public void setMessagesExpired(int messagesExpired) {
this.messagesExpired = messagesExpired;
}
public int getDeliveringCount() {
return deliveringCount;
}
public void setDeliveringCount(int deliveringCount) {
this.deliveringCount = deliveringCount;
}
public int getMessagesKilled() {
return messagesKilled;
}
public void setMessagesKilled(int messagesKilled) {
this.messagesKilled = messagesKilled;
}
public boolean isDirectDeliver() {
return directDeliver;
}
public void setDirectDeliver(boolean directDeliver) {
this.directDeliver = directDeliver;
}
public boolean isExclusive() {
return exclusive;
}
public void setExclusive(boolean exclusive) {
this.exclusive = exclusive;
}
public boolean isLastValue() {
return lastValue;
}
public void setLastValue(boolean lastValue) {
this.lastValue = lastValue;
}
public String getLastValueKey() {
return lastValueKey;
}
public void setLastValueKey(String lastValueKey) {
this.lastValueKey = lastValueKey;
}
public int getScheduledCount() {
return scheduledCount;
}
public void setScheduledCount(int scheduledCount) {
this.scheduledCount = scheduledCount;
}
public boolean isGroupRebalance() {
return groupRebalance;
}
public void setGroupRebalance(boolean groupRebalance) {
this.groupRebalance = groupRebalance;
}
public boolean isGroupRebalancePauseDispatch() {
return groupRebalancePauseDispatch;
}
public void setGroupRebalancePauseDispatch(boolean groupRebalancePauseDispatch) {
this.groupRebalancePauseDispatch = groupRebalancePauseDispatch;
}
public int getGroupBuckets() {
return groupBuckets;
}
public void setGroupBuckets(int groupBuckets) {
this.groupBuckets = groupBuckets;
}
public String getGroupFirstKey() {
return groupFirstKey;
}
public void setGroupFirstKey(String groupFirstKey) {
this.groupFirstKey = groupFirstKey;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public int getRingSize() {
return ringSize;
}
public void setRingSize(int ringSize) {
this.ringSize = ringSize;
}
public int getConsumersBeforeDispatch() {
return consumersBeforeDispatch;
}
public void setConsumersBeforeDispatch(int consumersBeforeDispatch) {
this.consumersBeforeDispatch = consumersBeforeDispatch;
}
public int getDelayBeforeDispatch() {
return delayBeforeDispatch;
}
public void setDelayBeforeDispatch(int delayBeforeDispatch) {
this.delayBeforeDispatch = delayBeforeDispatch;
}
public boolean isAutoDelete() {
return autoDelete;
}
public void setAutoDelete(boolean autoDelete) {
this.autoDelete = autoDelete;
}
public boolean isInternalQueue() {
return internalQueue;
}
public void setInternalQueue(boolean internalQueue) {
this.internalQueue = internalQueue;
}
}

View File

@ -0,0 +1,5 @@
package de.berlin.airport.artemis.json;
public class QueuePage extends APage<Queue> {
}

View File

@ -0,0 +1,50 @@
package de.berlin.airport.artemis.json;
// {"sessionID":"1d044f84-7b4b-11ef-be45-0242ac110002","creationTime":1727274801137,"consumerCount":1,"validatedUser":"artemis","principal":"artemis"}
public class Session {
private String sessionID;
private long creationTime;
private int consumerCount;
private String validatedUser;
private String principal;
public String getSessionID() {
return sessionID;
}
public void setSessionID(String sessionID) {
this.sessionID = sessionID;
}
public long getCreationTime() {
return creationTime;
}
public void setCreationTime(long creationTime) {
this.creationTime = creationTime;
}
public int getConsumerCount() {
return consumerCount;
}
public void setConsumerCount(int consumerCount) {
this.consumerCount = consumerCount;
}
public String getValidatedUser() {
return validatedUser;
}
public void setValidatedUser(String validatedUser) {
this.validatedUser = validatedUser;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
}

View File

@ -0,0 +1,16 @@
package de.berlin.airport.artemis.json;
import java.util.ArrayList;
public class Sessions extends ArrayList<Session> {
public Session getBySessionId(String sessionId) {
for (Session session: this) {
if (session.getSessionID().equals(sessionId)) {
return session;
}
}
return null;
}
}

3
start.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker container run --detach --name artemis -p 5672:5672 -p 1099:1099 -p 61616:61616 -p 8161:8161 apache/activemq-artemis:latest-alpine || docker container start artemis

3
stop.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker container stop artemis