Repository: activemq-artemis Updated Branches: refs/heads/master 800cc461c -> 6b17d966c
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml b/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml new file mode 100644 index 0000000..1095761 --- /dev/null +++ b/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml @@ -0,0 +1,77 @@ +<?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. +--> + +<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="urn:activemq" + xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> + + <jms xmlns="urn:activemq:jms"> + <!--the queue used by the example--> + <queue name="exampleQueue"/> + </jms> + + <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> + + <!-- Acceptors --> + <acceptors> + <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> + </acceptors> + + <!-- We need to create a core queue for the JMS queue explicitly because the connector will be deployed + before the JMS queue is deployed, so the first time, it otherwise won't find the queue --> + <queues> + <queue name="jms.queue.exampleQueue"> + <address>jms.queue.exampleQueue</address> + </queue> + </queues> + + <connector-services> + <connector-service name="aerogear-connector"> + <factory-class>org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory</factory-class> + <param key="endpoint" value="${endpoint}"/> + <param key="queue" value="jms.queue.exampleQueue"/> + <param key="application-id" value="${applicationid}"/> + <param key="master-secret" value="${mastersecret}"/> + </connector-service> + </connector-services> + + <!-- Other config --> + + <security-settings> + <!--security for example queue--> + <security-setting match="jms.queue.exampleQueue"> + <permission type="createDurableQueue" roles="guest"/> + <permission type="deleteDurableQueue" roles="guest"/> + <permission type="createNonDurableQueue" roles="guest"/> + <permission type="deleteNonDurableQueue" roles="guest"/> + <permission type="consume" roles="guest"/> + <permission type="send" roles="guest"/> + </security-setting> + </security-settings> + </core> +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties b/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties new file mode 100644 index 0000000..93537c4 --- /dev/null +++ b/examples/features/sub-modules/aerogear/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 +queue.queue/exampleQueue=exampleQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/artemis-ra-rar/pom.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/artemis-ra-rar/pom.xml b/examples/features/sub-modules/artemis-ra-rar/pom.xml new file mode 100644 index 0000000..cae1386 --- /dev/null +++ b/examples/features/sub-modules/artemis-ra-rar/pom.xml @@ -0,0 +1,101 @@ +<?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.modules</groupId> + <artifactId>broker-modules</artifactId> + <version>1.0.1-SNAPSHOT</version> + </parent> + + <artifactId>artemis-rar</artifactId> + <packaging>rar</packaging> + <name>ActiveMQ Artemis JMS RA</name> + + <properties> + <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-jms-client</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-core-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-jms-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jms_2.0_spec</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-ejb_3.0_spec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-ra</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-jms-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-core-client</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-core-client</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-rar-plugin</artifactId> + <configuration> + <raXmlFile>src/main/resources/ra.xml</raXmlFile> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/artemis-ra-rar/src/main/resources/ra.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/artemis-ra-rar/src/main/resources/ra.xml b/examples/features/sub-modules/artemis-ra-rar/src/main/resources/ra.xml new file mode 100644 index 0000000..db571a3 --- /dev/null +++ b/examples/features/sub-modules/artemis-ra-rar/src/main/resources/ra.xml @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- $Id: ra.xml 76819 2008-08-08 11:04:20Z jesper.pedersen $ --> + +<connector xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" + version="1.5"> + + <description>ActiveMQ Artemis 2.0 Resource Adapter</description> + <display-name>ActiveMQ Artemis 2.0 Resource Adapter</display-name> + + <vendor-name>Apache Software Foundation</vendor-name> + <eis-type>JMS 1.1 Server</eis-type> + <resourceadapter-version>1.0</resourceadapter-version> + + <license> + <description> + 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. + </description> + <license-required>true</license-required> + </license> + + <resourceadapter> + <resourceadapter-class>org.apache.activemq.artemis.ra.ActiveMQResourceAdapter</resourceadapter-class> + <config-property> + <description> + The transport type. Multiple connectors can be configured by using a comma separated list, + i.e. org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory,org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory. + </description> + <config-property-name>ConnectorClassName</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory</config-property-value> + </config-property> + <config-property> + <description>The transport configuration. These values must be in the form of key=val;key=val;, + if multiple connectors are used then each set must be separated by a comma i.e. host=host1;port=61616,host=host2;port=61617. + Each set of params maps to the connector classname specified. + </description> + <config-property-name>ConnectionParameters</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>server-id=0</config-property-value> + </config-property> + <!-- + <config-property> + <description>Does we support HA</description> + <config-property-name>HA</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value>false</config-property-value> + </config-property> + <config-property> + <description>The method to use for locating the transactionmanager</description> + <config-property-name>TransactionManagerLocatorMethod</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>getTm</config-property-value> + </config-property> + <config-property> + <description>Use A local Transaction instead of XA?</description> + <config-property-name>UseLocalTx</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value>false</config-property-value> + </config-property> + <config-property> + <description>The user name used to login to the JMS server</description> + <config-property-name>UserName</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The password used to login to the JMS server</description> + <config-property-name>Password</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The jndi params to use to look up the jms resources if local jndi is not to be used</description> + <config-property-name>JndiParams</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory;java.naming.provider.url=jnp://localhost:1199;java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces</config-property-value> + </config-property> + <config-property> + <description>The jGroups File name</description> + <config-property-name>JgroupsFile</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>jgroups.xml</config-property-value> + </config-property> + <config-property> + <description>The name of the channel used on this configuration</description> + <config-property-name>JgroupsChannelName</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value>my-channel</config-property-value> + </config-property> + <config-property> + <description>The discovery group address</description> + <config-property-name>DiscoveryAddress</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The discovery group port</description> + <config-property-name>DiscoveryPort</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The discovery refresh timeout</description> + <config-property-name>DiscoveryRefreshTimeout</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The discovery initial wait timeout</description> + <config-property-name>DiscoveryInitialWaitTimeout</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The load balancing policy class name</description> + <config-property-name>LoadBalancingPolicyClassName</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The client failure check period</description> + <config-property-name>ClientFailureCheckPeriod</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The connection TTL</description> + <config-property-name>ConnectionTTL</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The call timeout</description> + <config-property-name>CallTimeout</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The dups ok batch size</description> + <config-property-name>DupsOKBatchSize</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The transaction batch size</description> + <config-property-name>TransactionBatchSize</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The consumer window size</description> + <config-property-name>ConsumerWindowSize</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The consumer max rate</description> + <config-property-name>ConsumerMaxRate</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The confirmation window size</description> + <config-property-name>ConfirmationWindowSize</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The producer max rate</description> + <config-property-name>ProducerMaxRate</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The min large message size</description> + <config-property-name>MinLargeMessageSize</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The block on acknowledge</description> + <config-property-name>BlockOnAcknowledge</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The block on non durable send</description> + <config-property-name>BlockOnNonDurableSend</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The block on durable send</description> + <config-property-name>BlockOnDurableSend</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The auto group</description> + <config-property-name>AutoGroup</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The max connections</description> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The pre acknowledge</description> + <config-property-name>PreAcknowledge</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The retry interval</description> + <config-property-name>RetryInterval</config-property-name> + <config-property-type>java.lang.Long</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The retry interval multiplier</description> + <config-property-name>RetryIntervalMultiplier</config-property-name> + <config-property-type>java.lang.Double</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The client id</description> + <config-property-name>ClientID</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>Whether the password is cleartext or encrypted, default false</description> + <config-property-name>UseMaskedPassword</config-property-name> + <config-property-type>java.lang.Boolean</config-property-type> + <config-property-value></config-property-value> + </config-property> + <config-property> + <description>The class definition (full qualified name and its properties) used to encrypt the password</description> + <config-property-name>PasswordCodec</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;key=clusterpassword;algorithm=something</config-property-value> + </config-property>--> + + <outbound-resourceadapter> + <connection-definition> + <managedconnectionfactory-class>org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory</managedconnectionfactory-class> + + <config-property> + <description>The default session type</description> + <config-property-name>SessionDefaultType</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>javax.jms.Queue</config-property-value> + </config-property> + <config-property> + <description>Try to obtain a lock within specified number of seconds; less than or equal to 0 disable this functionality</description> + <config-property-name>UseTryLock</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value>0</config-property-value> + </config-property> + + <connectionfactory-interface>org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactory</connectionfactory-interface> + <connectionfactory-impl-class>org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl</connectionfactory-impl-class> + <connection-interface>javax.jms.Session</connection-interface> + <connection-impl-class>org.apache.activemq.artemis.ra.ActiveMQRASession</connection-impl-class> + </connection-definition> + <transaction-support>XATransaction</transaction-support> + <authentication-mechanism> + <authentication-mechanism-type>BasicPassword</authentication-mechanism-type> + <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface> + </authentication-mechanism> + <reauthentication-support>false</reauthentication-support> + </outbound-resourceadapter> + + <inbound-resourceadapter> + <messageadapter> + <messagelistener> + <messagelistener-type>javax.jms.MessageListener</messagelistener-type> + <activationspec> + <activationspec-class>org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec</activationspec-class> + <required-config-property> + <config-property-name>destination</config-property-name> + </required-config-property> + </activationspec> + </messagelistener> + </messageadapter> + </inbound-resourceadapter> + + </resourceadapter> +</connector> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/pom.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/pom.xml b/examples/features/sub-modules/pom.xml new file mode 100644 index 0000000..aeeae3c --- /dev/null +++ b/examples/features/sub-modules/pom.xml @@ -0,0 +1,58 @@ +<?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.clustered</groupId> + <artifactId>broker-features</artifactId> + <version>1.0.1-SNAPSHOT</version> + </parent> + + <groupId>org.apache.activemq.examples.modules</groupId> + <artifactId>broker-modules</artifactId> + <packaging>pom</packaging> + <name>ActiveMQ Artemis Modules 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> + <!-- The modules examples need to be executed manually, + for that reason we won't provide an examples profile here to execute all of them at once --> + <profile> + <id>release</id> + <modules> + <module>aerogear</module> + <module>artemis-ra-rar</module> + <module>vertx</module> + </modules> + </profile> + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/vertx/pom.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/vertx/pom.xml b/examples/features/sub-modules/vertx/pom.xml new file mode 100644 index 0000000..e38a299 --- /dev/null +++ b/examples/features/sub-modules/vertx/pom.xml @@ -0,0 +1,145 @@ +<?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.modules</groupId> + <artifactId>broker-modules</artifactId> + <version>1.0.1-SNAPSHOT</version> + </parent> + + <artifactId>artemis-vertx-example</artifactId> + <packaging>jar</packaging> + <name>ActiveMQ Artemis Vert.x Example</name> + + <properties> + <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> + <vertx.version>2.1.2</vertx.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-core-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-commons</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + <version>${netty.version}</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jms_2.0_spec</artifactId> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-core</artifactId> + <version>${vertx.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-platform</artifactId> + <version>${vertx.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>io.vertx</groupId> + <artifactId>vertx-hazelcast</artifactId> + <version>${vertx.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-vertx-integration</artifactId> + <version>${project.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> + <libList> + <arg>org.apache.activemq.examples.modules:artemis-vertx-example:${project.version}</arg> + </libList> + <instance>${basedir}/target/server0</instance> + <configuration>${basedir}/target/classes/activemq/server0</configuration> + </configuration> + </execution> + <execution> + <id>start0</id> + <goals> + <goal>cli</goal> + </goals> + <configuration> + <ignore>${noServer}</ignore> + <spawn>true</spawn> + <location>${basedir}/target/server0</location> + <testURI>tcp://localhost:61616</testURI> + <args> + <param>run</param> + </args> + <name>server0</name> + </configuration> + </execution> + <execution> + <id>runClient</id> + <goals> + <goal>runClient</goal> + </goals> + <configuration> + <clientClass>org.apache.activemq.artemis.core.example.VertxConnectorExample</clientClass> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.activemq.examples.modules</groupId> + <artifactId>artemis-vertx-example</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/vertx/readme.html ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/vertx/readme.html b/examples/features/sub-modules/vertx/readme.html new file mode 100644 index 0000000..e8f053a --- /dev/null +++ b/examples/features/sub-modules/vertx/readme.html @@ -0,0 +1,103 @@ +<!-- +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. +--> + +<html> + <head> + <title>ActiveMQ Artemis Vert.x Connector Service Example</title> + <link rel="stylesheet" type="text/css" href="../../../common/common.css" /> + <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" /> + <script type="text/javascript" src="../../../common/prettify.js"></script> + </head> + <body onload="prettyPrint()"> + <h1>Vert.x Connector Service Example</h1> + + <p>This example shows you how to configure ActiveMQ Artemis to use the Vert.x Connector Service.</p> + + <p>ActiveMQ Artemis supports 2 types of Vert.x connector, incoming and outgoing. + Incoming connector consumes from Vert.x event bus and forwards to a configurable address. + Outgoing connector consumes from a configurable address and forwards to a configurable Vert.x event bus. + </p> + + <p>In this example, an incoming connector and an outgoing connector are configured. A simple java Verticle + is deployed. The verticle registers a message handler on the outgoing connector's address ("outgoing.vertx.address"). + A String message is sent to Vert.x event bus on the incoming connector's address("incoming.vertx.address"). + The message then will be forwarded to a ActiveMQ Artemis queue by the incoming connector. The outgoing connector listens to + the ActiveMQ Artemis queue and forwards the message from ActiveMQ Artemis to Vert.x event bus on the outgoing connector's address. + The verticle finally receives the message from it's event bus.</p> + + <p>For more information on Vert.x concept please visit the <a href="http://vertx.io/">Vertx site</a></p> + + <h2>Example step-by-step</h2> + <p><i>To run the server, simply type <code>mvn verify</code> + from this directory.</p> + + <ol> + <li>First we need to create a Vert.x PlatformManager</li> + <pre class="prettyprint"> + <code>platformManager = PlatformLocator.factory.createPlatformManager(PORT, HOST);</code> + </pre> + + <li>We deploy a Verticle using the platformManager</li> + <pre class="prettyprint"> + <code>String verticle = "org.apache.activemq.artemis.core.example.ExampleVerticle"; + platformManager.deployVerticle(verticle, null, new URL[0], 1, null, + new Handler<AsyncResult<String>>(){ + + @Override + public void handle(AsyncResult<String> result) + { + if (!result.succeeded()) + { + throw new RuntimeException("failed to deploy verticle", result.cause()); + } + latch0.countDown(); + } + + });</code> + </pre> + + <li>We register a message handler with the event bus in the Verticle to listen on the outgoing connector's address.</li> + <pre class="prettyprint"> + <code>EventBus eventBus = vertx.eventBus(); + eventBus.registerHandler(VertxConnectorExample.OUTGOING, + new Handler<Message<?>>() { + @Override + public void handle(Message<?> startMsg) + { + Object body = startMsg.body(); + System.out.println("Verticle receives a message: " + body); + VertxConnectorExample.result.set(VertxConnectorExample.MSG.equals(body)); + latch0.countDown(); + } + }); + </code> + </pre> + + <li>We send a message to incoming connector's address via event bus</li> + <pre class="prettyprint"> + <code> + EventBus bus = platformManager.vertx().eventBus(); + bus.send(INCOMING, MSG); + </code> + </pre> + + <li>The message will eventually arrives at the Verticle's message handler.</li> + </ol> + </body> +</html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/ExampleVerticle.java ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/ExampleVerticle.java b/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/ExampleVerticle.java new file mode 100644 index 0000000..ac6ccdc --- /dev/null +++ b/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/ExampleVerticle.java @@ -0,0 +1,54 @@ +/* + * 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.core.example; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.vertx.java.core.Handler; +import org.vertx.java.core.eventbus.EventBus; +import org.vertx.java.core.eventbus.Message; +import org.vertx.java.platform.Verticle; + +public class ExampleVerticle extends Verticle { + + @Override + public void start() { + EventBus eventBus = vertx.eventBus(); + + final CountDownLatch latch0 = new CountDownLatch(1); + + // Register a handler on the outgoing connector's address + eventBus.registerHandler(VertxConnectorExample.OUTGOING, new Handler<Message<?>>() { + @Override + public void handle(Message<?> startMsg) { + Object body = startMsg.body(); + System.out.println("Verticle receives a message: " + body); + VertxConnectorExample.result.set(VertxConnectorExample.MSG.equals(body)); + latch0.countDown(); + //Tell the example to finish. + VertxConnectorExample.latch.countDown(); + } + }); + + try { + latch0.await(5000, TimeUnit.MILLISECONDS); + } + catch (InterruptedException e) { + } + } +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/VertxConnectorExample.java ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/VertxConnectorExample.java b/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/VertxConnectorExample.java new file mode 100644 index 0000000..e7f6d62 --- /dev/null +++ b/examples/features/sub-modules/vertx/src/main/java/org/apache/activemq/artemis/core/example/VertxConnectorExample.java @@ -0,0 +1,105 @@ +/* + * 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.core.example; + +import java.net.URL; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.vertx.java.core.AsyncResult; +import org.vertx.java.core.Handler; +import org.vertx.java.core.eventbus.EventBus; +import org.vertx.java.platform.PlatformLocator; +import org.vertx.java.platform.PlatformManager; +import org.vertx.java.spi.cluster.impl.hazelcast.HazelcastClusterManagerFactory; + +/** + * A simple example of using Vert.x connector service. + */ +public class VertxConnectorExample { + + public static final String INCOMING = "incoming.vertx.address"; + public static final String OUTGOING = "outgoing.vertx.address"; + public static final String MSG = "Welcome to Vertx world!"; + + public static final CountDownLatch latch = new CountDownLatch(1); + public static final AtomicBoolean result = new AtomicBoolean(false); + + private static final String HOST = "127.0.0.1"; + private static final int PORT = 0; + + public static void main(final String[] args) throws Exception { + System.setProperty("vertx.clusterManagerFactory", HazelcastClusterManagerFactory.class.getName()); + PlatformManager platformManager = null; + + try { + // Step 1 Create a Vert.x PlatformManager + platformManager = PlatformLocator.factory.createPlatformManager(PORT, HOST); + + final CountDownLatch latch0 = new CountDownLatch(1); + + // Step 2 Deploy a Verticle to receive message + String verticle = "org.apache.activemq.artemis.core.example.ExampleVerticle"; + platformManager.deployVerticle(verticle, null, new URL[0], 1, null, new Handler<AsyncResult<String>>() { + + @Override + public void handle(AsyncResult<String> result) { + if (!result.succeeded()) { + throw new RuntimeException("failed to deploy verticle", result.cause()); + } + latch0.countDown(); + } + + }); + + latch0.await(); + + // Step 3 Send a message to the incoming connector's address + EventBus bus = platformManager.vertx().eventBus(); + bus.send(INCOMING, MSG); + + // Step 4 Waiting for the Verticle to process the message + latch.await(10000, TimeUnit.MILLISECONDS); + } + finally { + if (platformManager != null) { + platformManager.undeployAll(null); + platformManager.stop(); + } + reportResultAndExit(); + } + } + + private static void reportResultAndExit() { + if (!result.get()) { + System.err.println(); + System.err.println("#####################"); + System.err.println("### FAILURE! ###"); + System.err.println("#####################"); + System.exit(1); + } + else { + System.out.println(); + System.out.println("#####################"); + System.out.println("### SUCCESS! ###"); + System.out.println("#####################"); + System.exit(0); + } + } + +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/sub-modules/vertx/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/features/sub-modules/vertx/src/main/resources/activemq/server0/broker.xml b/examples/features/sub-modules/vertx/src/main/resources/activemq/server0/broker.xml new file mode 100644 index 0000000..9be6726 --- /dev/null +++ b/examples/features/sub-modules/vertx/src/main/resources/activemq/server0/broker.xml @@ -0,0 +1,81 @@ +<?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. +--> + +<configuration xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> + <jms xmlns="urn:activemq:jms"> + <!--the queue used by the example--> + <queue name="exampleQueue"/> + </jms> + <core xmlns="urn:activemq:core"> + <bindings-directory>target/server0/data/messaging/bindings</bindings-directory> + + <journal-directory>target/server0/data/messaging/journal</journal-directory> + + <large-messages-directory>target/server0/data/messaging/largemessages</large-messages-directory> + + <paging-directory>target/server0/data/messaging/paging</paging-directory> + <!-- Connectors --> + + <connectors> + <connector name="netty-connector">tcp://localhost:61616</connector> + </connectors> + + <!-- Acceptors --> + <acceptors> + <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> + </acceptors> + + <!-- Other config --> + + <security-settings> + <!--security for example queue--> + <security-setting match="queue.vertxQueue"> + <permission type="consume" roles="guest"/> + <permission type="send" roles="guest"/> + </security-setting> + </security-settings> + + <queues> + <queue name="queue.vertxQueue"> + <address>queue.vertxQueue</address> + </queue> + </queues> + + <connector-services> + <connector-service name="my-incoming-vertx"> + <factory-class>org.apache.activemq.artemis.integration.vertx.VertxIncomingConnectorServiceFactory</factory-class> + <param key="queue" value="queue.vertxQueue"/> + <param key="host" value="localhost"/> + <param key="port" value="0"/> + <param key="vertx-address" value="incoming.vertx.address"/> + </connector-service> + <connector-service name="my-outgoing-vertx"> + <factory-class>org.apache.activemq.artemis.integration.vertx.VertxOutgoingConnectorServiceFactory</factory-class> + <param key="queue" value="queue.vertxQueue"/> + <param key="host" value="localhost"/> + <param key="port" value="0"/> + <param key="vertx-address" value="outgoing.vertx.address"/> + </connector-service> + </connector-services> + </core> + +</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index b3cd93e..e17ee02 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -93,8 +93,7 @@ under the License. </profiles> <modules> - <module>broker-features</module> - <module>perf</module> + <module>features</module> <module>protocols</module> </modules>