Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4E209184BA for ; Thu, 13 Aug 2015 04:13:24 +0000 (UTC) Received: (qmail 12404 invoked by uid 500); 13 Aug 2015 04:13:24 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 12318 invoked by uid 500); 13 Aug 2015 04:13:24 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 9033 invoked by uid 99); 13 Aug 2015 04:13:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2015 04:13:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BA7C3E681C; Thu, 13 Aug 2015 04:13:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Thu, 13 Aug 2015 04:13:55 -0000 Message-Id: <212de92406b44417a547355c31616618@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [37/48] activemq-artemis git commit: renaming broker-features -> features on examples http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 2b2ba2e..0000000 --- a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - ${data.dir:../data}/bindings - - ${data.dir:../data}/journal - - ${data.dir:../data}/largemessages - - ${data.dir:../data}/paging - - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties deleted file mode 100644 index 54bed6d..0000000 --- a/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties +++ /dev/null @@ -1,20 +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 -topic.topic/exampleTopic=exampleTopic http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded-simple/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded-simple/pom.xml b/examples/broker-features/standard/embedded-simple/pom.xml deleted file mode 100644 index 8ffd616..0000000 --- a/examples/broker-features/standard/embedded-simple/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - embedded-simple - jar - ActiveMQ Artemis JMS Simple Embedded Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-server - ${project.version} - - - org.apache.activemq - artemis-jms-server - ${project.version} - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.EmbeddedExample - - - - - - org.apache.activemq.examples.broker - embedded-simple - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded-simple/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded-simple/readme.html b/examples/broker-features/standard/embedded-simple/readme.html deleted file mode 100644 index 1bbd7aa..0000000 --- a/examples/broker-features/standard/embedded-simple/readme.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - ActiveMQ Artemis Embedded JMS Server Example - - - - - -

Embedded JMS Server Example

- -

This examples shows how to setup and run an embedded JMS server using ActiveMQ Artemis along with ActiveMQ Artemis configuration files.

- -

Example step-by-step

-

To run the example, simply type mvn verify -Pexample from this directory

- -
    -
  1. Create ActiveMQ Artemis core configuration files and make sure they are within your classpath. By default, ActiveMQ - expects the configuration file name to be "broker.xml".
  2. -
  3. Create an embedded ActiveMQ Artemis JMS server
  4. -
    -            EmbeddedJMS jmsServer = new EmbeddedJMS();
    -         
    - -
  5. Setup security configurations
  6. -
    -            SecurityConfiguration securityConfig = new SecurityConfiguration();
    -            securityConfig.addUser("guest", "guest");
    -            securityConfig.addRole("guest", "guest");
    -            securityConfig.setDefaultUser("guest");
    -            jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
    -         
    - -
  7. Start the embedded ActiveMQ Artemis JMS server
  8. -
    -            jmsServer.start()
    -         
    - -
  9. Create JMS resources (connection factory and queue) for the example
  10. -
    -            JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
    -            List connectors = new ArrayList();
    -            connectors.add("in-vm");
    -            jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
    -            jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");
    -         
    - -

    At this point the JMS server is started and any JMS clients can look up JMS resources from the JNDI to send/receive - messages from the server. To keep the example simple, we will send and receive a JMS message from the same JVM - used to run the JMS server.

    - -
  11. Lookup JMS resources defined in the configuration
  12. -
    -            ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("ConnectionFactory");
    -            Queue queue = (Queue)jmsServer.lookup("queue/exampleQueue");
    -         
    - -
  13. Send and receive a message using JMS API
  14. -

    See the Queue Example for detailed steps to send and receive a JMS message

    - -

    Finally, we stop the JMS server and its associated resources.

    - -
  15. Close the connection
  16. -
    -            if (connection != null)
    -            {
    -               connection.close();
    -            }
    -         
    - -
  17. Stop the JMS server
  18. -
    -            jmsServer.stop();
    -         
    - -
- - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java deleted file mode 100644 index 7d00c7e..0000000 --- a/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ /dev/null @@ -1,86 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import org.apache.activemq.artemis.api.jms.JMSFactoryType; -import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; -import org.apache.activemq.artemis.jms.server.JMSServerManager; -import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * This example demonstrates how to run an ActiveMQ Artemis embedded with JMS - */ -public class EmbeddedExample { - - public static void main(final String[] args) throws Exception { - EmbeddedJMS jmsServer = new EmbeddedJMS(); - - SecurityConfiguration securityConfig = new SecurityConfiguration(); - securityConfig.addUser("guest", "guest"); - securityConfig.addRole("guest", "guest"); - securityConfig.setDefaultUser("guest"); - jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig)); - - jmsServer.start(); - System.out.println("Started Embedded JMS Server"); - - JMSServerManager jmsServerManager = jmsServer.getJMSServerManager(); - List connectors = new ArrayList(); - connectors.add("in-vm"); - jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory"); - jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue"); - - ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("ConnectionFactory"); - Queue queue = (Queue) jmsServer.lookup("queue/exampleQueue"); - - // Step 10. Send and receive a message using JMS API - Connection connection = null; - try { - connection = cf.createConnection(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(queue); - TextMessage message = session.createTextMessage("Hello sent at " + new Date()); - System.out.println("Sending message: " + message.getText()); - producer.send(message); - MessageConsumer messageConsumer = session.createConsumer(queue); - connection.start(); - TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000); - System.out.println("Received message:" + messageReceived.getText()); - } - finally { - if (connection != null) { - connection.close(); - } - - // Step 11. Stop the JMS server - jmsServer.stop(); - System.out.println("Stopped the JMS Server"); - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml b/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml deleted file mode 100644 index 0448e3b..0000000 --- a/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - false - - - vm://0 - - - - vm://0 - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded/pom.xml b/examples/broker-features/standard/embedded/pom.xml deleted file mode 100644 index ee576c4..0000000 --- a/examples/broker-features/standard/embedded/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - embedded - jar - ActiveMQ Artemis JMS Embedded Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-server - ${project.version} - - - org.apache.activemq - artemis-jms-server - ${project.version} - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.EmbeddedExample - - - - - - org.apache.activemq.examples.broker - embedded - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded/readme.html b/examples/broker-features/standard/embedded/readme.html deleted file mode 100644 index 2da6ef7..0000000 --- a/examples/broker-features/standard/embedded/readme.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - ActiveMQ Artemis Embedded JMS Server Example - - - - - -

Embedded JMS Server Example

-
To run the example, simply type mvn verify from this directory
- -

This examples shows how to setup and run an embedded JMS server using ActiveMQ Artemis.

-

ActiveMQ Artemis was designed using POJOs (Plain Old Java Objects) which means embedding ActiveMQ Artemis in your own application - is as simple as instantiating a few objects.

-

This example does not use any configuration files. The server is configured using POJOs and can be easily ported to any dependency injection framework.
- We will setup and run a full-fledged JMS server which binds its JMS resources to JNDI and can be accessed by remote clients.

- - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java deleted file mode 100644 index cb39fd0..0000000 --- a/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ /dev/null @@ -1,107 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import java.util.ArrayList; -import java.util.Date; - -import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; -import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory; -import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; -import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration; -import org.apache.activemq.artemis.jms.server.config.JMSConfiguration; -import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration; -import org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl; -import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl; -import org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl; -import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS; - -/** - * This example demonstrates how to run an ActiveMQ Artemis embedded with JMS - */ -public final class EmbeddedExample { - - public static void main(final String[] args) throws Exception { - // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly - Configuration configuration = new ConfigurationImpl(); - configuration.setPersistenceEnabled(false); - configuration.setJournalDirectory("target/data/journal"); - configuration.setSecurityEnabled(false); - configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName())); - - TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName()); - - configuration.getConnectorConfigurations().put("connector", connectorConfig); - - // Step 2. Create the JMS configuration - JMSConfiguration jmsConfig = new JMSConfigurationImpl(); - - // Step 3. Configure the JMS ConnectionFactory - ArrayList connectorNames = new ArrayList(); - connectorNames.add("connector"); - ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(connectorNames).setBindings("cf"); - jmsConfig.getConnectionFactoryConfigurations().add(cfConfig); - - // Step 4. Configure the JMS Queue - JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1"); - jmsConfig.getQueueConfigurations().add(queueConfig); - - // Step 5. Start the JMS Server using the ActiveMQ Artemis core server and the JMS configuration - EmbeddedJMS jmsServer = new EmbeddedJMS(); - jmsServer.setConfiguration(configuration); - jmsServer.setJmsConfiguration(jmsConfig); - jmsServer.start(); - System.out.println("Started Embedded JMS Server"); - - // Step 6. Lookup JMS resources defined in the configuration - ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("cf"); - Queue queue = (Queue) jmsServer.lookup("queue/queue1"); - - // Step 7. Send and receive a message using JMS API - Connection connection = null; - try { - connection = cf.createConnection(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(queue); - TextMessage message = session.createTextMessage("Hello sent at " + new Date()); - System.out.println("Sending message: " + message.getText()); - producer.send(message); - MessageConsumer messageConsumer = session.createConsumer(queue); - connection.start(); - TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000); - System.out.println("Received message:" + messageReceived.getText()); - } - finally { - if (connection != null) { - connection.close(); - } - - // Step 11. Stop the JMS server - jmsServer.stop(); - System.out.println("Stopped the JMS Server"); - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/pom.xml b/examples/broker-features/standard/expiry/pom.xml deleted file mode 100644 index 983cc32..0000000 --- a/examples/broker-features/standard/expiry/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - expiry - jar - ActiveMQ Artemis JMS Expiry Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${noServer} - ${basedir}/target/classes/activemq/server0 - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.ExpiryExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.broker - expiry - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/readme.html b/examples/broker-features/standard/expiry/readme.html deleted file mode 100644 index d13cac0..0000000 --- a/examples/broker-features/standard/expiry/readme.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - ActiveMQ Artemis Message Expiration Example - - - - - -

JMS Expiration Example

-
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

This example shows you how to configure ActiveMQ Artemis so messages are expipired after a certain time.

-

Messages can be retained in the messaging system for a limited period of time before being removed. - JMS specification states that clients should not receive messages that have been expired (but it does not guarantee this will not happen).

-

ActiveMQ Artemis can assign a expiry address to a given queue so that when messages are expired, they are removed from the queue and - routed to this address. These "expired" messages can later be consumed for further inspection. -

- The example will send 1 message with a short time-to-live to a queue. We will wait for the message to expire and checks that the message - is no longer in the queue it was sent to. - We will instead consume it from an expiry queue where it was moved when it expired. -

-

Example setup

-

Expiry destinations are defined in the configuration file broker.xml:

-
-         <address-setting match="jms.queue.exampleQueue">
-            <expiry-address>jms.queue.expiryQueue</expiry-address>
-         </address-setting>
-         
-     
-

This configuration will moved expired messages from the exampleQueue to the expiryQueue

-

ActiveMQ Artemis allows to specify either a Queue by prefixing the expiry-address with jms.queue. - or a Topic by prefixing with jms.topic..
- In this example, we will use a Queue to hold the expired messages.

-

Since we want to consume messages from this expiryQueue, we also need to add a JNDI binding to perform a lookup. - This is configured in activemq-jms.xml

-
-         <queue name="expiryQueue">
-            <entry name="/queue/expiryQueue"/>
-         </queue>
-     
- - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java b/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java deleted file mode 100644 index 996da74..0000000 --- a/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java +++ /dev/null @@ -1,120 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.InitialContext; - -/** - * An example showing how messages are moved to an expiry queue when they expire. - */ -public class ExpiryExample { - - 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 2. Perfom a lookup on the queue - Queue queue = (Queue) initialContext.lookup("queue/exampleQueue"); - - // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4.Create a JMS Connection - connection = cf.createConnection(); - - // Step 5. Create a JMS Session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - // Step 7. Messages sent by this producer will be retained for 1s (1000ms) before expiration - producer.setTimeToLive(1000); - - // Step 8. Create a Text Message - TextMessage message = session.createTextMessage("this is a text message"); - - // Step 9. Send the Message - producer.send(message); - System.out.println("Sent message to " + queue.getQueueName() + ": " + message.getText()); - - // Step 10. Sleep for 5s. Once we wake up, the message will have been expired - System.out.println("Sleep a little bit to let the message expire..."); - Thread.sleep(5000); - - // Step 11. Create a JMS Message Consumer for the queue - MessageConsumer messageConsumer = session.createConsumer(queue); - - // Step 12. Start the Connection - connection.start(); - - // Step 13. Trying to receive a message. Since there is none on the queue, the call will timeout after 5000ms - // and messageReceived will be null - TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - System.out.println("Received message from " + queue.getQueueName() + ": " + messageReceived); - - // Step 14. Perfom a lookup on the expiry queue - Queue expiryQueue = (Queue) initialContext.lookup("queue/expiryQueue"); - - // Step 15. Create a JMS Message Consumer for the expiry queue - MessageConsumer expiryConsumer = session.createConsumer(expiryQueue); - - // Step 16. Receive the message from the expiry queue - messageReceived = (TextMessage) expiryConsumer.receive(5000); - - // Step 17. The message sent to the queue was moved to the expiry queue when it expired. - System.out.println("Received message from " + expiryQueue.getQueueName() + ": " + messageReceived.getText()); - - // The message received from the expiry queue has the same content than the expired message but its JMS headers - // differ - // (from JMS point of view, it's not the same message). - // ActiveMQ Artemis defines additional properties to correlate the message received from the expiry queue with the - // message expired from the queue - - System.out.println(); - // Step 18. the messageReceived's destination is now the expiry queue. - System.out.println("Destination of the expired message: " + ((Queue) messageReceived.getJMSDestination()).getQueueName()); - // Step 19. and its own expiration (the time to live in the *expiry* queue) - System.out.println("Expiration time of the expired message (relative to the expiry queue): " + messageReceived.getJMSExpiration()); - - System.out.println(); - // Step 20. the *origin* destination is stored in the _AMQ_ORIG_ADDRESS property - System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_AMQ_ORIG_ADDRESS")); - // Step 21. the actual expiration time is stored in the _AMQ_ACTUAL_EXPIRY property - System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_AMQ_ACTUAL_EXPIRY")); - } - finally { - // Step 22. Be sure to close the resources! - if (initialContext != null) { - initialContext.close(); - } - if (connection != null) { - connection.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -1,17 +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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -1,17 +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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 4907097..0000000 --- a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - ${data.dir:../data}/bindings - - ${data.dir:../data}/journal - - ${data.dir:../data}/largemessages - - ${data.dir:../data}/paging - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - - - jms.queue.expiryQueue - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/expiry/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/expiry/src/main/resources/jndi.properties b/examples/broker-features/standard/expiry/src/main/resources/jndi.properties deleted file mode 100644 index 231fa30..0000000 --- a/examples/broker-features/standard/expiry/src/main/resources/jndi.properties +++ /dev/null @@ -1,21 +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 -queue.queue/exampleQueue=exampleQueue -queue.queue/expiryQueue=expiryQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/pom.xml b/examples/broker-features/standard/http-transport/pom.xml deleted file mode 100644 index cfea5ef..0000000 --- a/examples/broker-features/standard/http-transport/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - http-transport - jar - ActiveMQ Artemis JMS Http Transport Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${noServer} - ${basedir}/target/classes/activemq/server0 - - - - start - - cli - - - ${noServer} - true - tcp://localhost:8080?http-enabled=true - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.HttpTransportExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.broker - http-transport - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/readme.html b/examples/broker-features/standard/http-transport/readme.html deleted file mode 100644 index 061c939..0000000 --- a/examples/broker-features/standard/http-transport/readme.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - ActiveMQ Artemis JMS HTTP Transport Example - - - - - -

JMS HTTP Example

- - -
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

This example shows you how to configure ActiveMQ Artemis to use the HTTP protocol as its transport layer.

- -

ActiveMQ Artemis supports a variety of network protocols to be its underlying transport without any specific code change.

- -

This example is taken from the queue example without any code change. By changing the configuration file, one can get ActiveMQ Artemis working with HTTP transport.

-

All you need to do is open the server0/broker.xml and enable HTTP like the following

- - -
-      
-      <connector name="netty-connector">tcp://localhost:8080?httpEnabled=true</connector>
-
-      <!-- Acceptors -->
-
-      <acceptor name="netty-acceptor">tcp://localhost:8080 </acceptor>
-      
-      
- - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java b/examples/broker-features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java deleted file mode 100644 index 265f0c6..0000000 --- a/examples/broker-features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java +++ /dev/null @@ -1,81 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; -import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; - -/** - * A simple JMS Queue example that uses HTTP protocol. - */ -public class HttpTransportExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - try { - // Step 2. Perfom a lookup on the queue - Queue queue = ActiveMQJMSClient.createQueue("exampleQueue"); - - // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:8080?http-enabled=true"); - - // Step 4.Create a JMS Connection - connection = cf.createConnection(); - - System.out.println("connection created: " + connection); - - // Step 5. Create a JMS Session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - // Step 7. Create a Text Message - TextMessage message = session.createTextMessage("This is a text message"); - - System.out.println("Sent message: " + message.getText()); - - // Step 8. Send the Message - producer.send(message); - - // Step 9. Create a JMS Message Consumer - MessageConsumer messageConsumer = session.createConsumer(queue); - - // Step 10. Start the Connection - connection.start(); - - // Step 11. Receive the message - TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - - System.out.println("Received message: " + messageReceived.getText()); - - } - finally { - if (connection != null) { - connection.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -1,17 +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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -1,17 +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. -## --------------------------------------------------------------------------- -guest=guest \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index d1a4d2a..0000000 --- a/examples/broker-features/standard/http-transport/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - ./data/bindings - - ./data/journal - - ./data/largemessages - - ./data/paging - - - - - tcp://localhost:8080 - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/instantiate-connection-factory/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/instantiate-connection-factory/pom.xml b/examples/broker-features/standard/instantiate-connection-factory/pom.xml deleted file mode 100644 index ac6024b..0000000 --- a/examples/broker-features/standard/instantiate-connection-factory/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - instantiate-connection-factory - jar - ActiveMQ Artemis JMS Instantiate Connection Factory Example - - - ${project.basedir}/../../../.. - - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${noServer} - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.InstantiateConnectionFactoryExample - - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.broker - instantiate-connection-factory - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/instantiate-connection-factory/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/instantiate-connection-factory/readme.html b/examples/broker-features/standard/instantiate-connection-factory/readme.html deleted file mode 100644 index b084471..0000000 --- a/examples/broker-features/standard/instantiate-connection-factory/readme.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - ActiveMQ Artemis JMS Instantiate Connection Factory Example - - - - - -

JMS Instantiate Connection Factory Example

- -
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

Usually, JMS Objects such as ConnectionFactories, Queue and Topic instances are looked up from JNDI - before being used by the client code. This objects are called "administered objects" in JMS specification - terminology.

-

However, in some cases a JNDI server may not be available or desired. To come to the rescue ActiveMQ - also supports the direct instantiation of these administered objects on the client side.

-

This allows the full set of JMS functionality to be available without requiring a JNDI server!

-

This example is very simple and based on the simple Queue example, however in this example we - instantiate the JMS Queue and ConnectionFactory objects directly.

-

A wide variety of methods are available for instantiating ConnectionFactory objects. In this example - we use a simple method which just takes the server connection details so it knows where to make the - connection to.

-

Other methods are available so all the connection factory parameters can be specified - including specifying UDP discovery so the client does not need hard-wired knowledge of where the servers - are that it wishes to connect to, or for specifying live-backup pairs of servers for failover.

-

For more information on instantiating ConnectionFactories directly please consult the user manual and - javadoc.

- - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java b/examples/broker-features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java deleted file mode 100644 index 47bc66c..0000000 --- a/examples/broker-features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java +++ /dev/null @@ -1,81 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; -import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; - -/** - * This example demonstrates how a JMS client can directly instantiate it's JMS Objects like - * Queue, ConnectionFactory, etc. without having to use JNDI at all. - * - * For more information please see the readme.html file. - */ -public class InstantiateConnectionFactoryExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - try { - // Step 1. Directly instantiate the JMS Queue object. - Queue queue = ActiveMQJMSClient.createQueue("exampleQueue"); - - // Starting with Artemis 1.0.1 you can just use the URI to instantiate the object directly - ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); - - // Step 4.Create a JMS Connection - connection = cf.createConnection(); - - // Step 5. Create a JMS Session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - // Step 7. Create a Text Message - TextMessage message = session.createTextMessage("This is a text message"); - - System.out.println("Sent message: " + message.getText()); - - // Step 8. Send the Message - producer.send(message); - - // Step 9. Create a JMS Message Consumer - MessageConsumer messageConsumer = session.createConsumer(queue); - - // Step 10. Start the Connection - connection.start(); - - // Step 11. Receive the message - TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - - System.out.println("Received message: " + messageReceived.getText()); - } - finally { - if (connection != null) { - connection.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/interceptor/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/interceptor/pom.xml b/examples/broker-features/standard/interceptor/pom.xml deleted file mode 100644 index fbf9654..0000000 --- a/examples/broker-features/standard/interceptor/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - interceptor - jar - ActiveMQ Artemis JMS Interceptor Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - org.apache.activemq.examples.broker:interceptor:${project.version} - ${noServer} - ${basedir}/target/classes/activemq/server0 - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.InterceptorExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.broker - interceptor - ${project.version} - - - - - - -