diff --git a/examples/features/standard/topic-hierarchies/pom.xml b/examples/features/standard/topic-hierarchies/pom.xml index e3fe3f87d3..3ebca912b2 100644 --- a/examples/features/standard/topic-hierarchies/pom.xml +++ b/examples/features/standard/topic-hierarchies/pom.xml @@ -57,6 +57,10 @@ under the License. ${noServer} + + --topics + news,news.usa,news.usa.wrestling,news.europe,news.europe.sport,news.europe.entertainment + 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 0a720dac12..5b9a0847b3 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(); } 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 9ec66c6f1e..0000000000 --- a/examples/features/standard/topic-hierarchies/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - ./data/bindings - - ./data/journal - - ./data/largemessages - - ./data/paging - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - 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 5cbe72c798..0000000000 --- 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