You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/22 14:24:54 UTC

[activemq-artemis] branch main updated (79daf49105 -> 3d5f588bbe)

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


    from 79daf49105 [maven-release-plugin] prepare for next development iteration
     new 4737c5c889 ARTEMIS-3901 Fix artemis perf client --durable fails on exception
     new e35758a4d0 ARTEMIS-3901 Improvements on PerfCommand
     new 3d5f588bbe This closes #4154

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commands/messages/perf/PerfClientCommand.java  | 197 +++++++++++++++++++++
 .../cli/commands/messages/perf/PerfCommand.java    |  75 ++++++++
 .../activemq/cli/test/CliPerfClientTest.java       |  67 +++++++
 3 files changed, 339 insertions(+)
 create mode 100644 artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java


[activemq-artemis] 02/03: ARTEMIS-3901 Improvements on PerfCommand

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit e35758a4d0802a9acf580352a2df1caa4c831af6
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Fri Jul 22 08:46:17 2022 -0400

    ARTEMIS-3901 Improvements on PerfCommand
---
 .../commands/messages/perf/PerfClientCommand.java  | 185 +++++++++++++++++++++
 .../cli/commands/messages/perf/PerfCommand.java    |  75 +++++++++
 .../activemq/cli/test/CliPerfClientTest.java       |  28 ++--
 3 files changed, 272 insertions(+), 16 deletions(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
index e8e7159fd4..0ffb448042 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
@@ -209,6 +209,191 @@ public class PerfClientCommand extends PerfCommand {
          // topic destinations instead.
          destinations = Collections.singletonList(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + "TEST");
       }
+
+      if (durableSubscription && clientID == null) {
+         throw new IllegalArgumentException("The clientID must be set on durable subscriptions");
+      }
+
       return super.execute(context);
    }
+
+   public boolean isTransaction() {
+      return transaction;
+   }
+
+   public PerfClientCommand setTransaction(boolean transaction) {
+      this.transaction = transaction;
+      return this;
+   }
+
+   public int getSharedSubscription() {
+      return sharedSubscription;
+   }
+
+   public PerfClientCommand setSharedSubscription(int sharedSubscription) {
+      this.sharedSubscription = sharedSubscription;
+      return this;
+   }
+
+   public boolean isDurableSubscription() {
+      return durableSubscription;
+   }
+
+   public PerfClientCommand setDurableSubscription(boolean durableSubscription) {
+      this.durableSubscription = durableSubscription;
+      return this;
+   }
+
+   public int getConsumerConnections() {
+      return consumerConnections;
+   }
+
+   public PerfClientCommand setConsumerConnections(int consumerConnections) {
+      this.consumerConnections = consumerConnections;
+      return this;
+   }
+
+   public int getConsumersPerDestination() {
+      return consumersPerDestination;
+   }
+
+   public PerfClientCommand setConsumersPerDestination(int consumersPerDestination) {
+      this.consumersPerDestination = consumersPerDestination;
+      return this;
+   }
+
+   public boolean isPersistent() {
+      return persistent;
+   }
+
+   public PerfClientCommand setPersistent(boolean persistent) {
+      this.persistent = persistent;
+      return this;
+   }
+
+   public int getMessageSize() {
+      return messageSize;
+   }
+
+   public PerfClientCommand setMessageSize(int messageSize) {
+      this.messageSize = messageSize;
+      return this;
+   }
+
+   public Long getRate() {
+      return rate;
+   }
+
+   public PerfClientCommand setRate(Long rate) {
+      this.rate = rate;
+      return this;
+   }
+
+   public long getTtl() {
+      return ttl;
+   }
+
+   public PerfClientCommand setTtl(long ttl) {
+      this.ttl = ttl;
+      return this;
+   }
+
+   public String getMsgGroupID() {
+      return msgGroupID;
+   }
+
+   public PerfClientCommand setMsgGroupID(String msgGroupID) {
+      this.msgGroupID = msgGroupID;
+      return this;
+   }
+
+   public boolean isSharedConnections() {
+      return sharedConnections;
+   }
+
+   public PerfClientCommand setSharedConnections(boolean sharedConnections) {
+      this.sharedConnections = sharedConnections;
+      return this;
+   }
+
+   public long getTxSize() {
+      return txSize;
+   }
+
+   public PerfClientCommand setTxSize(long txSize) {
+      this.txSize = txSize;
+      return this;
+   }
+
+   public int getProducersPerDestination() {
+      return producersPerDestination;
+   }
+
+   public PerfClientCommand setProducersPerDestination(int producersPerDestination) {
+      this.producersPerDestination = producersPerDestination;
+      return this;
+   }
+
+   public int getThreads() {
+      return threads;
+   }
+
+   public PerfClientCommand setThreads(int threads) {
+      this.threads = threads;
+      return this;
+   }
+
+   public long getMaxPending() {
+      return maxPending;
+   }
+
+   public PerfClientCommand setMaxPending(long maxPending) {
+      this.maxPending = maxPending;
+      return this;
+   }
+
+   public String getConsumerUrl() {
+      return consumerUrl;
+   }
+
+   public PerfClientCommand setConsumerUrl(String consumerUrl) {
+      this.consumerUrl = consumerUrl;
+      return this;
+   }
+
+   public String getConsumerProtocol() {
+      return consumerProtocol;
+   }
+
+   public PerfClientCommand setConsumerProtocol(String consumerProtocol) {
+      this.consumerProtocol = consumerProtocol;
+      return this;
+   }
+
+   public boolean isEnableMessageID() {
+      return enableMessageID;
+   }
+
+   public PerfClientCommand setEnableMessageID(boolean enableMessageID) {
+      this.enableMessageID = enableMessageID;
+      return this;
+   }
+
+   public boolean isEnableTimestamp() {
+      return enableTimestamp;
+   }
+
+   public PerfClientCommand setEnableTimestamp(boolean enableTimestamp) {
+      this.enableTimestamp = enableTimestamp;
+      return this;
+   }
+
+   public BenchmarkService getProducerBenchmark() {
+      return producerBenchmark;
+   }
+
+   public PerfClientCommand setProducerBenchmark(BenchmarkService producerBenchmark) {
+      this.producerBenchmark = producerBenchmark;
+      return this;
+   }
 }
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfCommand.java
index c30dc59899..0d57c752ae 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfCommand.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfCommand.java
@@ -151,4 +151,79 @@ public abstract class PerfCommand extends ConnectionAbstract {
       return jmsDestinations;
    }
 
+   public boolean isShowLatency() {
+      return showLatency;
+   }
+
+   public PerfCommand setShowLatency(boolean showLatency) {
+      this.showLatency = showLatency;
+      return this;
+   }
+
+   public String getReportFileName() {
+      return reportFileName;
+   }
+
+   public PerfCommand setReportFileName(String reportFileName) {
+      this.reportFileName = reportFileName;
+      return this;
+   }
+
+   public String getHdrFileName() {
+      return hdrFileName;
+   }
+
+   public PerfCommand setHdrFileName(String hdrFileName) {
+      this.hdrFileName = hdrFileName;
+      return this;
+   }
+
+   public int getDuration() {
+      return duration;
+   }
+
+   public PerfCommand setDuration(int duration) {
+      this.duration = duration;
+      return this;
+   }
+
+   public int getWarmup() {
+      return warmup;
+   }
+
+   public PerfCommand setWarmup(int warmup) {
+      this.warmup = warmup;
+      return this;
+   }
+
+   public long getMessageCount() {
+      return messageCount;
+   }
+
+   public PerfCommand setMessageCount(long messageCount) {
+      this.messageCount = messageCount;
+      return this;
+   }
+
+   public int getNumDestinations() {
+      return numDestinations;
+   }
+
+   public PerfCommand setNumDestinations(int numDestinations) {
+      this.numDestinations = numDestinations;
+      return this;
+   }
+
+   public List<String> getDestinations() {
+      return destinations;
+   }
+
+   public PerfCommand setDestinations(List<String> destinations) {
+      this.destinations = destinations;
+      return this;
+   }
+
+   public CountDownLatch getCompleted() {
+      return completed;
+   }
 }
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java
index aa487ec599..9f6668ade4 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java
@@ -16,10 +16,10 @@
  */
 package org.apache.activemq.cli.test;
 
-import org.apache.activemq.artemis.cli.commands.ActionContext;
 import org.apache.activemq.artemis.cli.commands.messages.perf.PerfClientCommand;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -46,26 +46,22 @@ public class CliPerfClientTest extends CliTestBase {
       super.tearDown();
    }
 
-   private void start(boolean durable) throws Exception {
-      PerfClientCommand command = new PerfClientCommand() {
-         @Override
-         public Object execute(ActionContext context) throws Exception {
-            clientID = "perfClientTest";
-            durableSubscription = durable;
-            messageCount = 1;
-            return super.execute(context);
-         }
-      };
-      command.setUser("admin").setPassword("admin").execute(new TestActionContext());
-   }
-
    @Test
    public void testNonDurableStarts() throws Exception {
-      start(false);
+      new PerfClientCommand().setDurableSubscription(false).setMessageCount(1).setUser("admin").setPassword("admin").setClientID("perfClientTest").execute(new TestActionContext());
    }
 
    @Test
    public void testDurableStarts() throws Exception {
-      start(true);
+      new PerfClientCommand().setDurableSubscription(true).setMessageCount(1).setUser("admin").setPassword("admin").setClientID("perfClientTest").execute(new TestActionContext());
+   }
+
+   @Test
+   public void testDurableNoClientIDSet() throws Exception {
+      try {
+         new PerfClientCommand().setDurableSubscription(true).setMessageCount(1).setUser("admin").setPassword("admin").execute(new TestActionContext());
+         Assert.fail("Exception expected");
+      } catch (IllegalArgumentException cliExpected) {
+      }
    }
 }
\ No newline at end of file


[activemq-artemis] 01/03: ARTEMIS-3901 Fix artemis perf client --durable fails on exception

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 4737c5c88978899d304ef1029b5adeea8df372ae
Author: Å mucr Jan <ja...@aimtec.cz>
AuthorDate: Fri Jul 22 14:19:09 2022 +0200

    ARTEMIS-3901 Fix artemis perf client --durable fails on exception
---
 .../commands/messages/perf/PerfClientCommand.java  | 12 ++++
 .../activemq/cli/test/CliPerfClientTest.java       | 71 ++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
index 2e2985688d..e8e7159fd4 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/messages/perf/PerfClientCommand.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.cli.commands.messages.perf;
 
 import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
+import java.util.Collections;
 import java.util.Queue;
 import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedTransferQueue;
@@ -30,6 +31,7 @@ import io.netty.channel.DefaultEventLoop;
 import io.netty.channel.DefaultEventLoopGroup;
 import io.netty.channel.EventLoop;
 import org.apache.activemq.artemis.cli.commands.ActionContext;
+import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
 
 @Command(name = "client", description = "It will produce and consume messages to a broker instance")
 public class PerfClientCommand extends PerfCommand {
@@ -199,4 +201,14 @@ public class PerfClientCommand extends PerfCommand {
          benchmark.close();
       }
    }
+
+   @Override
+   public Object execute(ActionContext context) throws Exception {
+      if (durableSubscription && (destinations == null || destinations.isEmpty())) {
+         // An empty destination list would create a single queue://TEST destination but durable subscriptions require
+         // topic destinations instead.
+         destinations = Collections.singletonList(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + "TEST");
+      }
+      return super.execute(context);
+   }
 }
diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java
new file mode 100644
index 0000000000..aa487ec599
--- /dev/null
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/CliPerfClientTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.cli.test;
+
+import org.apache.activemq.artemis.cli.commands.ActionContext;
+import org.apache.activemq.artemis.cli.commands.messages.perf.PerfClientCommand;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.jms.Connection;
+
+public class CliPerfClientTest extends CliTestBase {
+   private Connection connection;
+   private ActiveMQConnectionFactory cf;
+
+   @Before
+   @Override
+   public void setup() throws Exception {
+      setupAuth();
+      super.setup();
+      startServer();
+      cf = getConnectionFactory(61616);
+      connection = cf.createConnection("admin", "admin");
+   }
+
+   @After
+   @Override
+   public void tearDown() throws Exception {
+      closeConnection(cf, connection);
+      super.tearDown();
+   }
+
+   private void start(boolean durable) throws Exception {
+      PerfClientCommand command = new PerfClientCommand() {
+         @Override
+         public Object execute(ActionContext context) throws Exception {
+            clientID = "perfClientTest";
+            durableSubscription = durable;
+            messageCount = 1;
+            return super.execute(context);
+         }
+      };
+      command.setUser("admin").setPassword("admin").execute(new TestActionContext());
+   }
+
+   @Test
+   public void testNonDurableStarts() throws Exception {
+      start(false);
+   }
+
+   @Test
+   public void testDurableStarts() throws Exception {
+      start(true);
+   }
+}
\ No newline at end of file


[activemq-artemis] 03/03: This closes #4154

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 3d5f588bbed3fe191a88c45b1031b0c3c0f51258
Merge: 79daf49105 e35758a4d0
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Fri Jul 22 10:24:36 2022 -0400

    This closes #4154

 .../commands/messages/perf/PerfClientCommand.java  | 197 +++++++++++++++++++++
 .../cli/commands/messages/perf/PerfCommand.java    |  75 ++++++++
 .../activemq/cli/test/CliPerfClientTest.java       |  67 +++++++
 3 files changed, 339 insertions(+)