ARTEMIS-1089 Adding test for replication sync slow
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/739dd82f Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/739dd82f Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/739dd82f Branch: refs/heads/master Commit: 739dd82f31f7642f44e6c8cdd60967a07f33d71b Parents: 5b42474 Author: Clebert Suconic <[email protected]> Authored: Sun Apr 2 19:16:50 2017 -0400 Committer: Clebert Suconic <[email protected]> Committed: Sun Apr 2 20:20:45 2017 -0400 ---------------------------------------------------------------------- .../src/test/scripts/run-examples.sh | 6 + .../main/resources/activemq/server0/broker.xml | 2 +- .../main/resources/activemq/server1/broker.xml | 2 +- .../main/resources/activemq/server0/broker.xml | 2 +- .../main/resources/activemq/server1/broker.xml | 2 +- .../main/resources/activemq/server0/broker.xml | 2 +- .../main/resources/activemq/server1/broker.xml | 2 +- examples/pom.xml | 1 + examples/smoke/ha/pom.xml | 61 +++++ .../smoke/ha/replicated-flowcontrol/pom.xml | 112 +++++++++ .../example/ReplicatedFailbackStaticSmoke.java | 225 +++++++++++++++++++ .../main/resources/activemq/server0/broker.xml | 118 ++++++++++ .../main/resources/activemq/server1/broker.xml | 121 ++++++++++ .../src/main/resources/jndi.properties | 20 ++ examples/smoke/pom.xml | 60 +++++ examples/smoke/readme.md | 8 + 16 files changed, 738 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/artemis-distribution/src/test/scripts/run-examples.sh ---------------------------------------------------------------------- diff --git a/artemis-distribution/src/test/scripts/run-examples.sh b/artemis-distribution/src/test/scripts/run-examples.sh index f025c12..e9f2651 100755 --- a/artemis-distribution/src/test/scripts/run-examples.sh +++ b/artemis-distribution/src/test/scripts/run-examples.sh @@ -46,6 +46,7 @@ cd expiry; mvn verify; cd .. cd http-transport; mvn verify; cd .. cd interceptor; mvn verify; cd .. cd interceptor-client; mvn verify; cd .. +cd interceptor-client-mqtt; mvn verify; cd .. cd jms-auto-closeable; mvn verify; cd .. cd instantiate-connection-factory; mvn verify; cd .. cd jms-bridge; mvn verify; cd .. @@ -132,5 +133,10 @@ cd scale-down; mvn verify; cd .. cd transaction-failover; mvn verify; cd .. + +cd $ARTEMIS_HOME/examples/smoke/ha +cd replicated-flowcontrol; mvn verify; cd .. + + cd $CURRENT_DIR rm -rf target http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml index 5c41c7e..205de1b 100644 --- a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server0/broker.xml @@ -78,7 +78,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml index 7f38a8d..230d635 100644 --- a/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-failback-static/src/main/resources/activemq/server1/broker.xml @@ -80,7 +80,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml index e1b48b0..7b32414 100644 --- a/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-failback/src/main/resources/activemq/server0/broker.xml @@ -92,7 +92,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml index b557676..58f4738 100644 --- a/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-failback/src/main/resources/activemq/server1/broker.xml @@ -93,7 +93,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml index e6fee91..4e40497 100644 --- a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server0/broker.xml @@ -87,7 +87,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml index c92b409..16f62ec 100644 --- a/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/features/ha/replicated-transaction-failover/src/main/resources/activemq/server1/broker.xml @@ -88,7 +88,7 @@ under the License. <addresses> <address name="exampleQueue"> <anycast> - <queue name="jms.queue.exampleQueue"/> + <queue name="exampleQueue"/> </anycast> </address> </addresses> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index 06713b6..26b77ed 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -96,6 +96,7 @@ under the License. <modules> <module>features</module> <module>protocols</module> + <module>smoke</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/pom.xml ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/pom.xml b/examples/smoke/ha/pom.xml new file mode 100644 index 0000000..5e0eef1 --- /dev/null +++ b/examples/smoke/ha/pom.xml @@ -0,0 +1,61 @@ +<?xml version='1.0'?> +<!-- +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. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.activemq.examples.smoke</groupId> + <artifactId>smoke</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.activemq.examples.smoke.ha</groupId> + <artifactId>smoke-ha</artifactId> + <packaging>pom</packaging> + <name>ActiveMQ Artemis Failover Examples</name> + + <!-- Properties --> + <properties> + <!-- + Explicitly declaring the source encoding eliminates the following + message: [WARNING] Using platform encoding (UTF-8 actually) to copy + filtered resources, i.e. build is platform dependent! + --> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <activemq.basedir>${project.basedir}/../../..</activemq.basedir> + </properties> + + <profiles> + <profile> + <id>release</id> + <modules> + <module>replicated-flowcontrol</module> + </modules> + </profile> + <profile> + <id>examples</id> + <modules> + <module>replicated-flowcontrol</module> + </modules> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/replicated-flowcontrol/pom.xml ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/replicated-flowcontrol/pom.xml b/examples/smoke/ha/replicated-flowcontrol/pom.xml new file mode 100644 index 0000000..011ea2a --- /dev/null +++ b/examples/smoke/ha/replicated-flowcontrol/pom.xml @@ -0,0 +1,112 @@ +<?xml version='1.0'?> +<!-- +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. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.activemq.examples.smoke.ha</groupId> + <artifactId>smoke-ha</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <artifactId>replicated-flowcontrol</artifactId> + <packaging>jar</packaging> + <name>Smoke test for replication, simulating large flow conrol</name> + + <properties> + <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-cli</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-jms-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.qpid</groupId> + <artifactId>qpid-jms-client</artifactId> + <version>${qpid.jms.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-maven-plugin</artifactId> + <executions> + <execution> + <id>create0</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <!-- this makes it easier in certain envs --> + <javaOptions>-Djava.net.preferIPv4Stack=true</javaOptions> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>create1</id> + <goals> + <goal>create</goal> + </goals> + <configuration> + <!-- this makes it easier in certain envs --> + <javaOptions>-Djava.net.preferIPv4Stack=true</javaOptions> + <instance>${basedir}/target/server1</instance> + <configuration>${basedir}/target/classes/activemq/server1</configuration> + <javaOptions>-Dudp-address=${udp-address}</javaOptions> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.jms.example.ReplicatedFailbackStaticSmoke</clientClass> + <args> + <param>${basedir}/target/server0</param> + <param>${basedir}/target/server1</param> + </args> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.smoke.ha</groupId> + <artifactId>replicated-flowcontrol</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/replicated-flowcontrol/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticSmoke.java ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/replicated-flowcontrol/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticSmoke.java b/examples/smoke/ha/replicated-flowcontrol/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticSmoke.java new file mode 100644 index 0000000..723c6c3 --- /dev/null +++ b/examples/smoke/ha/replicated-flowcontrol/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackStaticSmoke.java @@ -0,0 +1,225 @@ +/* + * 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.artemis.jms.example; + +import javax.jms.BytesMessage; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.naming.InitialContext; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.util.ServerUtil; +import org.apache.activemq.artemis.utils.ReusableLatch; +import org.apache.qpid.jms.JmsConnectionFactory; + +/** + * Example of live and replicating backup pair. + * <p> + * After both servers are started, the live server is killed and the backup becomes active ("fails-over"). + * <p> + * Later the live server is restarted and takes back its position by asking the backup to stop ("fail-back"). + */ +public class ReplicatedFailbackStaticSmoke { + + private static Process server0; + + private static Process server1; + + static final int NUM_MESSAGES = 300_000; + static final int START_CONSUMERS = 100_000; + static final int START_SERVER = 101_000; + static final int KILL_SERVER = -1; // not killing the server right now.. just for future use + static final int NUMBER_OF_CONSUMERS = 10; + static final ReusableLatch latch = new ReusableLatch(NUM_MESSAGES); + + static AtomicBoolean running = new AtomicBoolean(true); + static AtomicInteger totalConsumed = new AtomicInteger(0); + + public static void main(final String[] args) throws Exception { + + Connection connection = null; + + InitialContext initialContext = null; + + try { + server0 = ServerUtil.startServer(args[0], ReplicatedFailbackStaticSmoke.class.getSimpleName() + "0", 0, 30000); + + initialContext = new InitialContext(); + + ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); + + connection = connectionFactory.createConnection(); + + Session session = connection.createSession(true, Session.SESSION_TRANSACTED); + + Queue queue = session.createQueue("exampleQueue"); + + connection.start(); + + MessageProducer producer = session.createProducer(queue); + + BytesMessage bytesMessage = session.createBytesMessage(); + bytesMessage.writeBytes(new byte[20 * 1024]); + + for (int i = 0; i < NUM_MESSAGES; i++) { + + producer.send(bytesMessage); + if (i % 1000 == 0) { + System.out.println("Sent " + i + " messages, consumed=" + totalConsumed.get()); + session.commit(); + } + + if (i == START_CONSUMERS) { + System.out.println("Starting consumers"); + startConsumers(); + } + + if (KILL_SERVER >= 0 && i == KILL_SERVER) { + System.out.println("Killing server"); + ServerUtil.killServer(server0); + } + + if (i == START_SERVER) { + System.out.println("Starting extra server"); + server1 = ServerUtil.startServer(args[1], ReplicatedFailbackStaticSmoke.class.getSimpleName() + "1", 1, 10000); + } + + } + + session.commit(); + + System.out.println("Awaiting all consumers to finish"); + while (!latch.await(5, TimeUnit.SECONDS)) { + System.out.println("Missing " + latch.getCount() + ", totalConsumed = " + totalConsumed); + } + + } finally { + + running.set(false); + + if (connection != null) { + connection.close(); + } + + if (initialContext != null) { + initialContext.close(); + } + + ServerUtil.killServer(server0); + ServerUtil.killServer(server1); + } + } + + static void startConsumers() { + for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { + Consumer consumer = new Consumer(i % 2 == 0, i); + consumer.start(); + + } + } + + static class Consumer extends Thread { + + ConnectionFactory factory; + Connection connection; + Session session; + Queue queue; + MessageConsumer consumer; + int count = 0; + int totalCount = 0; + + final int consumerID; + + final boolean amqp; + + Consumer(boolean amqp, int id) { + super("amqp=" + amqp + ", id=" + id); + this.amqp = amqp; + this.consumerID = id; + } + + @Override + public String toString() { + return "Consumer " + consumerID + ", amqp::" + amqp; + } + + void connect() throws Exception { + count = 0; + if (amqp) { + factory = new JmsConnectionFactory("amqp://localhost:61616"); + } else { + factory = new ActiveMQConnectionFactory(); // using default is fine here + } + + connection = factory.createConnection(); + session = connection.createSession(true, Session.SESSION_TRANSACTED); + queue = session.createQueue("exampleQueue"); + consumer = session.createConsumer(queue); + connection.start(); + } + + @Override + public void run() { + while (running.get()) { + try { + if (connection == null) { + connect(); + } + + totalCount++; + if (totalCount % 1000 == 0) { + System.out.println(this + " received " + totalCount + " messages"); + } + + BytesMessage message = (BytesMessage) consumer.receive(5000); + if (message == null) { + System.out.println("Consumer " + this + " couldn't get a message"); + if (count > 0) { + session.commit(); + latch.countDown(count); + totalConsumed.addAndGet(count); + count = 0; + } + } else { + count++; + + if (count == 100) { + session.commit(); + latch.countDown(count); + totalConsumed.addAndGet(count); + count = 0; + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + System.out.println("Giving up the loop " + this); + + } + + } +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server0/broker.xml b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server0/broker.xml new file mode 100644 index 0000000..0e58838 --- /dev/null +++ b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server0/broker.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- +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. +--><configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> + + + + <core xmlns="urn:activemq:core"> + + <bindings-directory>./data/bindings</bindings-directory> + + <journal-directory>./data/journal</journal-directory> + + <large-messages-directory>./data/largemessages</large-messages-directory> + + <paging-directory>./data/paging</paging-directory> + + <cluster-user>exampleUser</cluster-user> + + <cluster-password>secret</cluster-password> + + <ha-policy> + <replication> + <master> + <!--we need this for auto failback--> + <check-for-live-server>true</check-for-live-server> + </master> + </replication> + </ha-policy> + + <connectors> + <connector name="netty-connector">tcp://localhost:61616</connector> + <connector name="netty-backup-connector">tcp://localhost:61617</connector> + </connectors> + + <!-- Acceptors --> + <acceptors> + <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> + </acceptors> + + <cluster-connections> + <cluster-connection name="my-cluster"> + <connector-ref>netty-connector</connector-ref> + <static-connectors> + <connector-ref>netty-backup-connector</connector-ref> + </static-connectors> + </cluster-connection> + </cluster-connections> + <!-- Other config --> + + <security-settings> + <!--security for example queue--> + <security-setting match="exampleQueue"> + <permission roles="guest" type="createDurableQueue"/> + <permission roles="guest" type="deleteDurableQueue"/> + <permission roles="guest" type="createNonDurableQueue"/> + <permission roles="guest" type="deleteNonDurableQueue"/> + <permission roles="guest" type="consume"/> + <permission roles="guest" type="send"/> + </security-setting> + </security-settings> + <address-settings> + <!-- if you define auto-create on certain queues, management has to be auto-create --> + <address-setting match="activemq.management#"> + <dead-letter-address>DLQ</dead-letter-address> + <expiry-address>ExpiryQueue</expiry-address> + <redelivery-delay>0</redelivery-delay> + <!-- with -1 only the global-max-size is in use for limiting --> + <max-size-bytes>-1</max-size-bytes> + <message-counter-history-day-limit>10</message-counter-history-day-limit> + <address-full-policy>PAGE</address-full-policy> + <auto-create-queues>true</auto-create-queues> + <auto-create-addresses>true</auto-create-addresses> + <auto-create-jms-queues>true</auto-create-jms-queues> + <auto-create-jms-topics>true</auto-create-jms-topics> + </address-setting> + <!--default for catch all--> + <address-setting match="#"> + <dead-letter-address>DLQ</dead-letter-address> + <expiry-address>ExpiryQueue</expiry-address> + <redelivery-delay>0</redelivery-delay> + <!-- with -1 only the global-max-size is in use for limiting --> + <max-size-bytes>200MB</max-size-bytes> + <page-size-bytes>100MB</page-size-bytes> + + <message-counter-history-day-limit>10</message-counter-history-day-limit> + <address-full-policy>PAGE</address-full-policy> + <auto-create-queues>true</auto-create-queues> + <auto-create-addresses>true</auto-create-addresses> + <auto-create-jms-queues>true</auto-create-jms-queues> + <auto-create-jms-topics>true</auto-create-jms-topics> + </address-setting> + </address-settings> + + <addresses> + <address name="exampleQueue"> + <anycast> + <queue name="exampleQueue"/> + </anycast> + </address> + </addresses> + </core> +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server1/broker.xml b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server1/broker.xml new file mode 100644 index 0000000..e67613d --- /dev/null +++ b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/activemq/server1/broker.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- +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. +--><configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> + + + + <core xmlns="urn:activemq:core"> + + <bindings-directory>./data/bindings</bindings-directory> + + <journal-directory>./data/journal</journal-directory> + + <large-messages-directory>./data/largemessages</large-messages-directory> + + <paging-directory>./data/paging</paging-directory> + + <cluster-user>exampleUser</cluster-user> + + <cluster-password>secret</cluster-password> + + <ha-policy> + <replication> + <slave> + <allow-failback>true</allow-failback> + <!-- not needed but tells the backup not to restart after failback as there will be > 0 backups saved --> + <max-saved-replicated-journals-size>0</max-saved-replicated-journals-size> + </slave> + </replication> + </ha-policy> + + <!-- Connectors --> + <connectors> + <connector name="netty-live-connector">tcp://localhost:61616</connector> + <connector name="netty-connector">tcp://localhost:61617</connector> + </connectors> + + <!-- Acceptors --> + <acceptors> + <acceptor name="netty-acceptor">tcp://localhost:61617</acceptor> + </acceptors> + + <cluster-connections> + <cluster-connection name="my-cluster"> + <connector-ref>netty-connector</connector-ref> + <static-connectors> + <connector-ref>netty-live-connector</connector-ref> + </static-connectors> + </cluster-connection> + </cluster-connections> + <!-- Other config --> + + <security-settings> + <!--security for example queue--> + <security-setting match="exampleQueue"> + <permission roles="guest" type="createDurableQueue"/> + <permission roles="guest" type="deleteDurableQueue"/> + <permission roles="guest" type="createNonDurableQueue"/> + <permission roles="guest" type="deleteNonDurableQueue"/> + <permission roles="guest" type="consume"/> + <permission roles="guest" type="send"/> + </security-setting> + </security-settings> + + <address-settings> + <!-- if you define auto-create on certain queues, management has to be auto-create --> + <address-setting match="activemq.management#"> + <dead-letter-address>DLQ</dead-letter-address> + <expiry-address>ExpiryQueue</expiry-address> + <redelivery-delay>0</redelivery-delay> + <!-- with -1 only the global-max-size is in use for limiting --> + <max-size-bytes>-1</max-size-bytes> + <message-counter-history-day-limit>10</message-counter-history-day-limit> + <address-full-policy>PAGE</address-full-policy> + <auto-create-queues>true</auto-create-queues> + <auto-create-addresses>true</auto-create-addresses> + <auto-create-jms-queues>true</auto-create-jms-queues> + <auto-create-jms-topics>true</auto-create-jms-topics> + </address-setting> + <!--default for catch all--> + <address-setting match="#"> + <dead-letter-address>DLQ</dead-letter-address> + <expiry-address>ExpiryQueue</expiry-address> + <redelivery-delay>0</redelivery-delay> + <!-- with -1 only the global-max-size is in use for limiting --> + <max-size-bytes>200MB</max-size-bytes> + <page-size-bytes>100MB</page-size-bytes> + + <message-counter-history-day-limit>10</message-counter-history-day-limit> + <address-full-policy>PAGE</address-full-policy> + <auto-create-queues>true</auto-create-queues> + <auto-create-addresses>true</auto-create-addresses> + <auto-create-jms-queues>true</auto-create-jms-queues> + <auto-create-jms-topics>true</auto-create-jms-topics> + </address-setting> + </address-settings> + + <addresses> + <address name="exampleQueue"> + <anycast> + <queue name="exampleQueue"/> + </anycast> + </address> + </addresses> + </core> +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/ha/replicated-flowcontrol/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/smoke/ha/replicated-flowcontrol/src/main/resources/jndi.properties b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/jndi.properties new file mode 100644 index 0000000..7f7a19f --- /dev/null +++ b/examples/smoke/ha/replicated-flowcontrol/src/main/resources/jndi.properties @@ -0,0 +1,20 @@ +# 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. + +java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory +connectionFactory.ConnectionFactory=tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1 +queue.queue/exampleQueue=exampleQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/pom.xml ---------------------------------------------------------------------- diff --git a/examples/smoke/pom.xml b/examples/smoke/pom.xml new file mode 100644 index 0000000..5c0c08e --- /dev/null +++ b/examples/smoke/pom.xml @@ -0,0 +1,60 @@ +<?xml version='1.0'?> +<!-- +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. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.activemq.examples</groupId> + <artifactId>artemis-examples</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.activemq.examples.smoke</groupId> + <artifactId>smoke</artifactId> + <packaging>pom</packaging> + <name>ActiveMQ Artemis Smoke Tests</name> + + <!-- Properties --> + <properties> + <!-- + Explicitly declaring the source encoding eliminates the following + message: [WARNING] Using platform encoding (UTF-8 actually) to copy + filtered resources, i.e. build is platform dependent! + --> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <activemq.basedir>${project.basedir}/../..</activemq.basedir> + </properties> + + <profiles> + <profile> + <id>examples</id> + <modules> + <module>ha</module> + </modules> + </profile> + <profile> + <id>release</id> + <modules> + <module>ha</module> + </modules> + </profile> + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/739dd82f/examples/smoke/readme.md ---------------------------------------------------------------------- diff --git a/examples/smoke/readme.md b/examples/smoke/readme.md new file mode 100644 index 0000000..2b99851 --- /dev/null +++ b/examples/smoke/readme.md @@ -0,0 +1,8 @@ +# Smoke Tests + +Everything under this folder is not meant for "educational" purposes. + +These represent production-like scenarios. + +In cases where a testcase may be too short lived, we use these smoke tests +to validate production like scenarios
