You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/10/25 13:19:23 UTC

[08/33] activemq-artemis git commit: ARTEMIS-756 Introduced an example for CDI integration, added a README to explain how it works.

ARTEMIS-756 Introduced an example for CDI integration, added a README to explain how it works.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2ee742bd
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2ee742bd
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2ee742bd

Branch: refs/heads/ARTEMIS-780
Commit: 2ee742bd751285182fdc188a30409303b1a4dcd7
Parents: 0f69bbd
Author: John D. Ament <jo...@apache.org>
Authored: Fri Oct 21 21:18:59 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Oct 24 10:37:27 2016 -0400

----------------------------------------------------------------------
 examples/features/sub-modules/cdi/pom.xml       | 252 +++++++++++++++++++
 examples/features/sub-modules/cdi/readme.md     |  86 +++++++
 .../artemis/core/example/CDIClientConfig.java   |  87 +++++++
 .../artemis/core/example/CDIExample.java        |  36 +++
 .../core/example/CDIMessagingIntegrator.java    |  40 +++
 .../META-INF/apache-deltaspike.properties       |  22 ++
 .../cdi/src/main/resources/META-INF/beans.xml   |  25 ++
 .../main/resources/activemq/server0/broker.xml  |  77 ++++++
 examples/features/sub-modules/pom.xml           |   1 +
 .../src/main/resources/META-INF/beans.xml       |  25 ++
 .../javax.enterprise.inject.spi.Extension       |  20 ++
 11 files changed, 671 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/pom.xml b/examples/features/sub-modules/cdi/pom.xml
new file mode 100644
index 0000000..30580d5
--- /dev/null
+++ b/examples/features/sub-modules/cdi/pom.xml
@@ -0,0 +1,252 @@
+<?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.5.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>artemis-cdi-example</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis CDI Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+      <deltaspike.version>1.7.1</deltaspike.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>org.apache.activemq</groupId>
+         <artifactId>artemis-cdi-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.deltaspike.cdictrl</groupId>
+         <artifactId>deltaspike-cdictrl-api</artifactId>
+         <version>${deltaspike.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>javax.enterprise</groupId>
+         <artifactId>cdi-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.deltaspike.core</groupId>
+         <artifactId>deltaspike-core-api</artifactId>
+         <version>${deltaspike.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.deltaspike.core</groupId>
+         <artifactId>deltaspike-core-impl</artifactId>
+         <version>${deltaspike.version}</version>
+      </dependency>
+   </dependencies>
+   <profiles>
+      <profile>
+         <id>Weld</id>
+         <activation>
+            <activeByDefault>true</activeByDefault>
+         </activation>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.activemq</groupId>
+                  <artifactId>artemis-maven-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>create0</id>
+                        <goals>
+                           <goal>create</goal>
+                        </goals>
+                        <configuration>
+                           <libListWithDeps>
+                              <arg>org.apache.activemq.examples.modules:artemis-cdi-example:${project.version}</arg>
+                           </libListWithDeps>
+
+                           <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.CDIExample</clientClass>
+                        </configuration>
+                     </execution>
+                  </executions>
+                  <dependencies>
+                     <dependency>
+                        <groupId>org.apache.activemq.examples.modules</groupId>
+                        <artifactId>artemis-cdi-example</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.jboss.weld.se</groupId>
+                        <artifactId>weld-se</artifactId>
+                        <version>${weld.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.deltaspike.cdictrl</groupId>
+                        <artifactId>deltaspike-cdictrl-weld</artifactId>
+                        <version>${deltaspike.version}</version>
+                     </dependency>
+                  </dependencies>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>OWB</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.activemq</groupId>
+                  <artifactId>artemis-maven-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>create0</id>
+                        <goals>
+                           <goal>create</goal>
+                        </goals>
+                        <configuration>
+                           <libListWithDeps>
+                              <arg>org.apache.activemq.examples.modules:artemis-cdi-example:${project.version}</arg>
+                           </libListWithDeps>
+
+                           <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.CDIExample</clientClass>
+                        </configuration>
+                     </execution>
+                  </executions>
+                  <dependencies>
+                     <dependency>
+                        <groupId>org.apache.activemq.examples.modules</groupId>
+                        <artifactId>artemis-cdi-example</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>javax.enterprise</groupId>
+                        <artifactId>cdi-api</artifactId>
+                        <version>${cdi-api.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.openwebbeans</groupId>
+                        <artifactId>openwebbeans-impl</artifactId>
+                        <version>${owb.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.openwebbeans</groupId>
+                        <artifactId>openwebbeans-spi</artifactId>
+                        <version>${owb.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.openwebbeans</groupId>
+                        <artifactId>openwebbeans-resource</artifactId>
+                        <version>${owb.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.geronimo.specs</groupId>
+                        <artifactId>geronimo-annotation_1.2_spec</artifactId>
+                        <version>${geronimo-annotation_1.2_spec.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.apache.deltaspike.cdictrl</groupId>
+                        <artifactId>deltaspike-cdictrl-owb</artifactId>
+                        <version>${deltaspike.version}</version>
+                     </dependency>
+                  </dependencies>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/readme.md
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/readme.md b/examples/features/sub-modules/cdi/readme.md
new file mode 100644
index 0000000..7e981ca
--- /dev/null
+++ b/examples/features/sub-modules/cdi/readme.md
@@ -0,0 +1,86 @@
+<!--
+# 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.
+#
+-->
+# ActiveMQ Artemis CDI Integration Example
+
+This is a simple example that demonstrates how to use CDI to integrate with ActiveMQ Artemis on the client side.  It is designed mainly for connecting to a remote broker rather than embedding within your application.
+
+## Configuring the connection
+
+While the integration provides an out of the box solution for configuration with some sensible defaults, the values should be configurable.  This example leverages [Apache DeltaSpike](https://deltaspike.apache.org) to configure the connectivity.  It overrides the username, password and URL for the broker.  The configuration hard codes the connector class.  This configuration class is a standard CDI bean.
+
+```
+@ApplicationScoped
+public class CDIClientConfig implements ArtemisClientConfiguration {
+   @Inject
+   @ConfigProperty(name = "username")
+   private String username;
+
+   @Inject
+   @ConfigProperty(name = "password")
+   private String password;
+
+   @Inject
+   @ConfigProperty(name = "url")
+   private String url;
+
+   @Override
+   public String getUsername() {
+      return username;
+   }
+
+   @Override
+   public String getPassword() {
+      return password;
+   }
+
+   @Override
+   public String getUrl() {
+      return url;
+   }
+
+   @Override
+   public String getConnectorFactory() {
+      return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
+   }
+}
+```
+
+## Setup and Tear Down
+
+For the example, we leverage DeltaSpike's Container Control to start and stop the container.  It is implemented within the main method, and is done in a way to make this work for both Weld and OpenWebBeans.
+
+## Sending and Receiving Messages
+
+The key to how the CDI integration works is the built in beans.  It provides two out of the box - a `ConnectionFactory` and a `JMSContext`.  Most operations should be performed against the JMS 2.0 simplified API using `JMSContext`.  The example does this via an observer method, but can be done anywhere.
+
+```
+@ApplicationScoped
+public class CDIMessagingIntegrator {
+   @Inject
+   private JMSContext context;
+   public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
+      String body = "This is a test";
+      Queue queue = context.createQueue("test");
+      context.createProducer().send(queue, body);
+      String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
+      System.out.println("Received a message "+receivedBody);
+   }
+}
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
new file mode 100644
index 0000000..93037ca
--- /dev/null
+++ b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIClientConfig.java
@@ -0,0 +1,87 @@
+/*
+ * 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 javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.artemis.client.cdi.configuration.ArtemisClientConfiguration;
+import org.apache.deltaspike.core.api.config.ConfigProperty;
+
+@ApplicationScoped
+public class CDIClientConfig implements ArtemisClientConfiguration {
+   @Inject
+   @ConfigProperty(name = "username")
+   private String username;
+
+   @Inject
+   @ConfigProperty(name = "password")
+   private String password;
+
+   @Inject
+   @ConfigProperty(name = "url")
+   private String url;
+
+
+   @Override
+   public String getUsername() {
+      return username;
+   }
+
+   @Override
+   public String getPassword() {
+      return password;
+   }
+
+   @Override
+   public String getUrl() {
+      return url;
+   }
+
+   @Override
+   public String getHost() {
+      return null;
+   }
+
+   @Override
+   public Integer getPort() {
+      return null;
+   }
+
+   @Override
+   public String getConnectorFactory() {
+      return "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory";
+   }
+
+   @Override
+   public boolean startEmbeddedBroker() {
+      return false;
+   }
+
+   @Override
+   public boolean isHa() {
+      return false;
+   }
+
+   @Override
+   public boolean hasAuthentication() {
+      return false;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
new file mode 100644
index 0000000..bbbf49c
--- /dev/null
+++ b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIExample.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.apache.deltaspike.cdise.api.CdiContainer;
+import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+
+/**
+ * A simple example using DeltaSpike CDI Control to connect to an external broker
+ */
+public class CDIExample {
+
+   public static void main(final String[] args) throws Exception {
+      CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+      cdiContainer.boot();
+
+      cdiContainer.shutdown();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
new file mode 100644
index 0000000..b4d7817
--- /dev/null
+++ b/examples/features/sub-modules/cdi/src/main/java/org/apache/activemq/artemis/core/example/CDIMessagingIntegrator.java
@@ -0,0 +1,40 @@
+/*
+ * 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 javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Initialized;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.jms.JMSContext;
+import javax.jms.Queue;
+
+@ApplicationScoped
+public class CDIMessagingIntegrator {
+   @Inject
+   private JMSContext context;
+   public void init(@Observes @Initialized(ApplicationScoped.class) Object obj) {
+      String body = "This is a test";
+      Queue queue = context.createQueue("test");
+      context.createProducer().send(queue, body);
+      String receivedBody = context.createConsumer(queue).receiveBody(String.class, 5000);
+      System.out.println("Received a message "+receivedBody);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties b/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
new file mode 100644
index 0000000..eb75483
--- /dev/null
+++ b/examples/features/sub-modules/cdi/src/main/resources/META-INF/apache-deltaspike.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+username=guest
+password=guest
+url=tcp://localhost:61616
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml b/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..b6f51f1
--- /dev/null
+++ b/examples/features/sub-modules/cdi/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,25 @@
+<!--
+  ~ 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.
+  -->
+
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+		http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+       bean-discovery-mode="annotated">
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/cdi/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/cdi/src/main/resources/activemq/server0/broker.xml b/examples/features/sub-modules/cdi/src/main/resources/activemq/server0/broker.xml
new file mode 100644
index 0000000..de51e9a
--- /dev/null
+++ b/examples/features/sub-modules/cdi/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="urn:activemq">
+   <jms xmlns="urn:activemq:jms">
+      <queue name="DLQ"/>
+      <queue name="ExpiryQueue"/>
+   </jms>
+   <core xmlns="urn:activemq:core">
+      <paging-directory>./target/paging</paging-directory>
+
+      <bindings-directory>./target/bindings</bindings-directory>
+
+      <journal-directory>./target/journal</journal-directory>
+
+      <journal-min-files>2</journal-min-files>
+
+      <large-messages-directory>./target/large-messages</large-messages-directory>
+
+      <connectors>
+         <!-- Default Connector.  Returned to clients during broadcast and distributed around cluster.  See broadcast and discovery-groups -->
+         <connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
+      </connectors>
+
+      <acceptors>
+         <!-- Default ActiveMQ Artemis Acceptor.  Multi-protocol adapter.  Currently supports Core, OpenWire, Stomp and AMQP. -->
+         <acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
+
+         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
+         <acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
+
+         <!-- STOMP Acceptor. -->
+         <acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
+
+         <!-- HornetQ Compatibility Acceptor.  Enables ActiveMQ Artemis Core and STOMP for legacy HornetQ clients. -->
+         <acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
+      </acceptors>
+
+      <security-settings>
+         <security-setting match="#">
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="send" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+      <address-settings>
+         <!--default for catch all-->
+         <address-setting match="#">
+            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+            <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <max-size-bytes>10485760</max-size-bytes>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>BLOCK</address-full-policy>
+         </address-setting>
+      </address-settings>
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/examples/features/sub-modules/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/pom.xml b/examples/features/sub-modules/pom.xml
index 5dfc9cd..79fc7d7 100644
--- a/examples/features/sub-modules/pom.xml
+++ b/examples/features/sub-modules/pom.xml
@@ -52,6 +52,7 @@ under the License.
             <module>aerogear</module>
             <module>artemis-ra-rar</module>
             <module>vertx</module>
+            <module>cdi</module>
          </modules>
       </profile>
    </profiles>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml b/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..b6f51f1
--- /dev/null
+++ b/integration/artemis-cdi-integration/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,25 @@
+<!--
+  ~ 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.
+  -->
+
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+		http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+       bean-discovery-mode="annotated">
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2ee742bd/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..81282d4
--- /dev/null
+++ b/integration/artemis-cdi-integration/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -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.
+#
+
+org.apache.artemis.client.cdi.extension.ArtemisExtension
\ No newline at end of file