You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/31 20:50:42 UTC

activemq-artemis git commit: small improvement on topic hierarchies example

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 1642a856c -> ce924b7ef


small improvement on topic hierarchies example


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

Branch: refs/heads/master
Commit: ce924b7ef039e9d10ebd52bc98aef35fa33a359d
Parents: 1642a85
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Aug 31 12:36:37 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Aug 31 14:48:41 2015 -0400

----------------------------------------------------------------------
 .../features/standard/topic-hierarchies/pom.xml |  4 ++
 .../jms/example/TopicHierarchyExample.java      | 12 +---
 .../main/resources/activemq/server0/broker.xml  | 71 --------------------
 .../src/main/resources/jndi.properties          | 19 ------
 4 files changed, 6 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ce924b7e/examples/features/standard/topic-hierarchies/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/topic-hierarchies/pom.xml b/examples/features/standard/topic-hierarchies/pom.xml
index e3fe3f8..3ebca91 100644
--- a/examples/features/standard/topic-hierarchies/pom.xml
+++ b/examples/features/standard/topic-hierarchies/pom.xml
@@ -57,6 +57,10 @@ under the License.
                   </goals>
                   <configuration>
                      <ignore>${noServer}</ignore>
+                     <args>
+                        <arg>--topics</arg>
+                        <arg>news,news.usa,news.usa.wrestling,news.europe,news.europe.sport,news.europe.entertainment</arg>
+                     </args>
                   </configuration>
                </execution>
                <execution>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ce924b7e/examples/features/standard/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java b/examples/features/standard/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
index 0a720da..5b9a084 100644
--- a/examples/features/standard/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
+++ b/examples/features/standard/topic-hierarchies/src/main/java/org/apache/activemq/artemis/jms/example/TopicHierarchyExample.java
@@ -24,9 +24,9 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
-import javax.naming.InitialContext;
 
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
 
 /**
  * This example demonstrates how a JMS TopicSubscriber can be created to subscribe to a wild-card Topic.
@@ -37,13 +37,8 @@ public class TopicHierarchyExample {
 
    public static void main(final String[] args) throws Exception {
       Connection connection = null;
-      InitialContext initialContext = null;
       try {
-         // Step 1. Create an initial context to perform the JNDI lookup.
-         initialContext = new InitialContext();
-
-         // Step 3. Perform a lookup on the Connection Factory
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
+         ConnectionFactory cf = new ActiveMQConnectionFactory();
 
          // Step 4. Create a JMS Connection
          connection = cf.createConnection();
@@ -110,9 +105,6 @@ public class TopicHierarchyExample {
       }
       finally {
          // Step 12. Be sure to close our resources!
-         if (initialContext != null) {
-            initialContext.close();
-         }
          if (connection != null) {
             connection.close();
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ce924b7e/examples/features/standard/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/topic-hierarchies/src/main/resources/activemq/server0/broker.xml b/examples/features/standard/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 9ec66c6..0000000
--- a/examples/features/standard/topic-hierarchies/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?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 topics used by the example-->
-
-      <topic name="news"/>
-
-      <topic name="news.usa"/>
-
-      <topic name="news.usa.wrestling"/>
-
-      <topic name="news.europe"/>
-
-      <topic name="news.europe.sport"/>
-
-      <topic name="news.europe.entertainment"/>
-   </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>
-
-      <!-- Other config -->
-
-      <security-settings>
-         <!--security for example queue-->
-         <security-setting match="jms.#">
-            <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/ce924b7e/examples/features/standard/topic-hierarchies/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/topic-hierarchies/src/main/resources/jndi.properties b/examples/features/standard/topic-hierarchies/src/main/resources/jndi.properties
deleted file mode 100644
index 5cbe72c..0000000
--- a/examples/features/standard/topic-hierarchies/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,19 +0,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.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616