Compare commits
No commits in common. "424699b35f1865e4c8dddf835a183eff3c3a4b99" and "17fae78801321e0c7e0fe22cb8f4d313f98371d6" have entirely different histories.
424699b35f
...
17fae78801
31
pom.xml
31
pom.xml
@ -9,37 +9,10 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<mainClass>de.berlin.airport.artemis.Main</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.qpid/protonj2-client -->
|
<!-- https://mvnrepository.com/artifact/org.apache.qpid/protonj2-client -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -31,14 +31,14 @@ import de.berlin.airport.artemis.json.Sessions;
|
|||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
private static String QUEUE = "foobar";
|
private static final String QUEUE = "foobar";
|
||||||
private static String USERNAME = "artemis";
|
private static final String USERNAME = "artemis";
|
||||||
private static String PASSWORD = "artemis";
|
private static final String PASSWORD = "artemis";
|
||||||
private static String AMQP_HOST = "localhost";
|
private static final String AMQP_HOST = "localhost";
|
||||||
private static String BROKER_NAME = "0.0.0.0";
|
private static final String BROKER_NAME = "0.0.0.0";
|
||||||
private static int AMQP_PORT = 5672;
|
private static final int AMQP_PORT = 5672;
|
||||||
private static String JMX_HOST = "localhost";
|
private static final String JMX_HOST = "localhost";
|
||||||
private static int JMX_PORT = 1099;
|
private static final int JMX_PORT = 1099;
|
||||||
|
|
||||||
public void run() throws IOException, MalformedObjectNameException, InstanceNotFoundException, MBeanException,
|
public void run() throws IOException, MalformedObjectNameException, InstanceNotFoundException, MBeanException,
|
||||||
ReflectionException, NamingException, ClientException {
|
ReflectionException, NamingException, ClientException {
|
||||||
@ -55,8 +55,7 @@ public class Main {
|
|||||||
Sender amqpSender = amqpConnectionSender.openSender(QUEUE);
|
Sender amqpSender = amqpConnectionSender.openSender(QUEUE);
|
||||||
|
|
||||||
Client amqpClientReceiver = Client.create();
|
Client amqpClientReceiver = Client.create();
|
||||||
Connection amqpConnectionReceiver = amqpClientReceiver.connect(AMQP_HOST, AMQP_PORT,
|
Connection amqpConnectionReceiver = amqpClientReceiver.connect(AMQP_HOST, AMQP_PORT, ampqConnectionOptions);
|
||||||
ampqConnectionOptions);
|
|
||||||
Receiver amqpReceiver = amqpConnectionReceiver.openReceiver(QUEUE);
|
Receiver amqpReceiver = amqpConnectionReceiver.openReceiver(QUEUE);
|
||||||
|
|
||||||
amqpSender.send(Message.create("Hello baz"));
|
amqpSender.send(Message.create("Hello baz"));
|
||||||
@ -66,8 +65,7 @@ public class Main {
|
|||||||
Connections connections = jmxBroker.getConnections();
|
Connections connections = jmxBroker.getConnections();
|
||||||
Sessions sessions = jmxBroker.getSessions();
|
Sessions sessions = jmxBroker.getSessions();
|
||||||
QueuePage queuePage = jmxBroker.getQueuesPaged(
|
QueuePage queuePage = jmxBroker.getQueuesPaged(
|
||||||
"{\"field\":\"\",\"operation\":\"\",\"value\":\"\",\"sortOrder\":\"asc\",\"sortColumn\":\"name\"}",
|
"{\"field\":\"\",\"operation\":\"\",\"value\":\"\",\"sortOrder\":\"asc\",\"sortColumn\":\"name\"}", 1,
|
||||||
1,
|
|
||||||
200);
|
200);
|
||||||
Producers producers = jmxBroker.getProducers();
|
Producers producers = jmxBroker.getProducers();
|
||||||
HashMap<de.berlin.airport.artemis.json.Connection, Consumers> consumersPerConnection = new HashMap<>();
|
HashMap<de.berlin.airport.artemis.json.Connection, Consumers> consumersPerConnection = new HashMap<>();
|
||||||
@ -108,8 +106,7 @@ public class Main {
|
|||||||
System.out.println(
|
System.out.println(
|
||||||
"|----------|----------------------------|--------------------------------------|-----------|----------|");
|
"|----------|----------------------------|--------------------------------------|-----------|----------|");
|
||||||
for (Queue queue : queuePage.getData()) {
|
for (Queue queue : queuePage.getData()) {
|
||||||
System.out.println(String.format("| %8d | %-26s | %-36s | %9d | %8d |", queue.getId(),
|
System.out.println(String.format("| %8d | %-26s | %-36s | %9d | %8d |", queue.getId(), queue.getAddress(),
|
||||||
queue.getAddress(),
|
|
||||||
queue.getName(), queue.getConsumerCount(), queue.getMessageCount()));
|
queue.getName(), queue.getConsumerCount(), queue.getMessageCount()));
|
||||||
}
|
}
|
||||||
System.out.println(
|
System.out.println(
|
||||||
@ -167,21 +164,6 @@ public class Main {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
if (args.length == 8) {
|
|
||||||
int i = 0;
|
|
||||||
Main.AMQP_HOST = args[i++];
|
|
||||||
Main.AMQP_PORT = Integer.parseInt(args[i++]);
|
|
||||||
Main.JMX_HOST = args[i++];
|
|
||||||
Main.JMX_PORT = Integer.parseInt(args[i++]);
|
|
||||||
Main.USERNAME = args[i++];
|
|
||||||
Main.PASSWORD = args[i++];
|
|
||||||
Main.BROKER_NAME = args[i++];
|
|
||||||
Main.QUEUE = args[i++];
|
|
||||||
} else {
|
|
||||||
System.err.println("Usage: Main <amqp host> <amqp port> <jmx host> <jmx port> <username> <password> <broker name> <queue>");
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Main main = new Main();
|
Main main = new Main();
|
||||||
main.run();
|
main.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user