diff --git a/docs/images/amqp-consumer.png b/docs/images/amqp-consumer.png index 418a970..e8cb111 100644 Binary files a/docs/images/amqp-consumer.png and b/docs/images/amqp-consumer.png differ diff --git a/docs/images/amqp-publisher.png b/docs/images/amqp-publisher.png index 5fa7fae..b027fc9 100644 Binary files a/docs/images/amqp-publisher.png and b/docs/images/amqp-publisher.png differ diff --git a/src/main/java/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java b/src/main/java/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java index e26df4c..918113e 100644 --- a/src/main/java/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java +++ b/src/main/java/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java @@ -51,6 +51,7 @@ public abstract class AMQPSampler extends AbstractSampler implements ThreadListe private static final String QUEUE_REDECLARE = "AMQPSampler.Redeclare"; private static final String QUEUE_EXCLUSIVE = "AMQPSampler.QueueExclusive"; private static final String QUEUE_AUTO_DELETE = "AMQPSampler.QueueAutoDelete"; + private static final String QUEUE_QUORUM = "AMQPSampler.QueueQuorum"; public static final String[] EXCHANGE_TYPES = new String[] { "direct", @@ -74,6 +75,7 @@ public abstract class AMQPSampler extends AbstractSampler implements ThreadListe public static final boolean DEFAULT_QUEUE_AUTO_DELETE = false; public static final boolean DEFAULT_QUEUE_REDECLARE = false; public static final boolean DEFAULT_QUEUE_EXCLUSIVE = false; + public static final boolean DEFAULT_QUEUE_QUORUM = false; public static final String DEFAULT_MSG_TTL = ""; public static final String DEFAULT_MSG_EXPIRES = ""; @@ -170,6 +172,10 @@ protected boolean configureQueue(Channel channel) throws IOException, NoSuchAlgo private Map getQueueArguments() { Map arguments = new HashMap<>(); + if (queueQuorum()) { + arguments.put("x-queue-type", "quorum"); + } + if (getMessageTTL() != null && !getMessageTTL().isEmpty()) { arguments.put("x-message-ttl", getMessageTTLAsInt()); } @@ -467,6 +473,25 @@ public boolean queueAutoDelete() { return getPropertyAsBoolean(QUEUE_AUTO_DELETE); } + /** + * @return whether the queue should be of type quorum + */ + public String getQueueQuorum() { + return getPropertyAsString(QUEUE_QUORUM); + } + + public void setQueueQuorum(String content) { + setProperty(QUEUE_QUORUM, content); + } + + public void setQueueQuorum(Boolean value) { + setProperty(QUEUE_QUORUM, value.toString()); + } + + public boolean queueQuorum() { + return getPropertyAsBoolean(QUEUE_QUORUM); + } + /** * @return the whether the queue should be redeclared */ diff --git a/src/main/java/com/zeroclue/jmeter/protocol/amqp/gui/AMQPSamplerGui.java b/src/main/java/com/zeroclue/jmeter/protocol/amqp/gui/AMQPSamplerGui.java index 79d67ca..3526db5 100644 --- a/src/main/java/com/zeroclue/jmeter/protocol/amqp/gui/AMQPSamplerGui.java +++ b/src/main/java/com/zeroclue/jmeter/protocol/amqp/gui/AMQPSamplerGui.java @@ -44,6 +44,7 @@ public abstract class AMQPSamplerGui extends AbstractSamplerGui { protected final JCheckBox queueRedeclare = new JCheckBox("Redeclare", AMQPSampler.DEFAULT_QUEUE_REDECLARE); protected final JCheckBox queueExclusive = new JCheckBox("Exclusive", AMQPSampler.DEFAULT_QUEUE_EXCLUSIVE); protected final JCheckBox queueAutoDelete = new JCheckBox("Auto Delete", AMQPSampler.DEFAULT_QUEUE_AUTO_DELETE); + protected final JCheckBox queueQuorum = new JCheckBox("Quorum", AMQPSampler.DEFAULT_QUEUE_QUORUM); protected JLabeledTextField virtualHost = new JLabeledTextField("Virtual Host"); protected JLabeledTextField host = new JLabeledTextField(" Host"); @@ -91,6 +92,7 @@ public void configure(TestElement element) { queueRedeclare.setSelected(sampler.getQueueRedeclare()); queueAutoDelete.setSelected(sampler.queueAutoDelete()); queueExclusive.setSelected(sampler.queueExclusive()); + queueQuorum.setSelected(sampler.queueQuorum()); virtualHost.setText(sampler.getVirtualHost()); host.setText(sampler.getHost()); @@ -127,6 +129,7 @@ public void clearGui() { queueRedeclare.setSelected(AMQPSampler.DEFAULT_QUEUE_REDECLARE); queueAutoDelete.setSelected(AMQPSampler.DEFAULT_QUEUE_AUTO_DELETE); queueExclusive.setSelected(AMQPSampler.DEFAULT_QUEUE_EXCLUSIVE); + queueQuorum.setSelected(AMQPSampler.DEFAULT_QUEUE_QUORUM); virtualHost.setText(AMQPSampler.DEFAULT_VIRTUAL_HOST); host.setText(AMQPSampler.DEFAULT_HOSTNAME); @@ -165,6 +168,7 @@ public void modifyTestElement(TestElement element) { sampler.setQueueRedeclare(queueRedeclare.isSelected()); sampler.setQueueAutoDelete(queueAutoDelete.isSelected()); sampler.setQueueExclusive(queueExclusive.isSelected()); + sampler.setQueueQuorum(queueQuorum.isSelected()); sampler.setVirtualHost(virtualHost.getText()); sampler.setHost(host.getText()); @@ -286,6 +290,10 @@ private Component makeCommonPanel() { gridBagConstraints.gridy = 3; queueSettings.add(queueExclusive, gridBagConstraints); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + queueSettings.add(queueQuorum, gridBagConstraints); + gridBagConstraintsCommon.gridx = 0; gridBagConstraintsCommon.gridy = 0;