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 528F5184AD for ; Thu, 13 Aug 2015 04:13:23 +0000 (UTC) Received: (qmail 11212 invoked by uid 500); 13 Aug 2015 04:13:23 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 11098 invoked by uid 500); 13 Aug 2015 04:13:23 -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 8865 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 92124E36E4; 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:46 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [28/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/security/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/readme.html b/examples/broker-features/standard/security/readme.html deleted file mode 100644 index d25dd42..0000000 --- a/examples/broker-features/standard/security/readme.html +++ /dev/null @@ -1,326 +0,0 @@ - - - - - ActiveMQ Artemis JMS Security Example - - - - - -

JMS Security 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 how to configure and use security using ActiveMQ Artemis.

- -

With security properly configured, ActiveMQ Artemis can restrict client access to its resources, including - connection creation, message sending/receiving, etc. This is done by configuring users and roles as well as permissions in - the configuration files.

- -

ActiveMQ Artemis supports wild-card security configuration. This feature makes security configuration very - flexible and enables fine-grained control over permissions in an efficient way.

- -

For a full description of how to configure security with ActiveMQ Artemis, please consult the user - manual.

- -

This example demonstrates how to configure users/roles, how to configure topics with proper permissions using wild-card - expressions, and how they take effects in a simple program.

- -

First we need to configure users with roles. Users and Roles are configured in activemq-users.xml. This example has four users - configured as below

- -
-     
-		   <user name="bill" password="activemq">
-		      <role name="user"/>
-		   </user>
-
-		   <user name="andrew" password="activemq1">
-		      <role name="europe-user"/>
-		      <role name="user"/>
-		   </user>
-
-		   <user name="frank" password="activemq2">
-		      <role name="us-user"/>
-		      <role name="news-user"/>
-		      <role name="user"/>
-		   </user>
-
-		   <user name="sam" password="activemq3">
-		      <role name="news-user"/>
-		      <role name="user"/>
-		   </user>
-     
-     
- -

- Each user has three properties available: user name, password, and roles it belongs to. It should be noted that - a user can belong to more than one role. In the above configuration, all users belong to role 'user'. User 'andrew' also - belongs to role 'europe-user', user 'frank' also belongs to 'us-user' and 'news-user' and user 'sam' also belongs to 'news-user'. -

-

- User name and password consists of a valid account that can be used to establish connections to a ActiveMQ Artemis server, while - roles are used in controlling the access privileges against ActiveMQ Artemis topics and queues. You can achieve this control by - configuring proper permissions in broker.xml, like the following -

-

-      <security-settings>
-         <!-- any user can have full control of generic topics -->
-		   <security-setting match="jms.topic.#">
-		      <permission type="createDurableQueue" roles="user"/>
-		      <permission type="deleteDurableQueue" roles="user"/>
-		      <permission type="createNonDurableQueue" roles="user"/>
-		      <permission type="deleteNonDurableQueue" roles="user"/>
-		      <permission type="send" roles="user"/>
-		      <permission type="consume" roles="user"/>
-		   </security-setting>
-
-		   <security-setting match="jms.topic.news.europe.#">
-		      <permission type="createDurableQueue" roles="user"/>
-		      <permission type="deleteDurableQueue" roles="user"/>
-		      <permission type="createNonDurableQueue" roles="user"/>
-		      <permission type="deleteNonDurableQueue" roles="user"/>
-		      <permission type="send" roles="europe-user"/>
-		      <permission type="consume" roles="news-user"/>
-		   </security-setting>
-
-		   <security-setting match="jms.topic.news.us.#">
-		      <permission type="createDurableQueue" roles="user"/>
-		      <permission type="deleteDurableQueue" roles="user"/>
-		      <permission type="createNonDurableQueue" roles="user"/>
-		      <permission type="deleteNonDurableQueue" roles="user"/>
-		      <permission type="send" roles="us-user"/>
-		      <permission type="consume" roles="news-user"/>
-		   </security-setting>
-     </security-settings>
-     
- -

Permissions can be defined on any group of queues, by using a wildcard. You can easily specify - wildcards to apply certain permissions to a set of matching queues and topics. In the above configuration - we have created four sets of permissions, each set matches against a special group of targets, indicated by wild-card match attributes.

- -

You can provide a very broad permission control as a default and then add more strict control - over specific addresses. By the above we define the following access rules:

- -
  • Only role 'us-user' can create/delete and pulish messages to topics whose names match wild-card pattern 'news.us.#'.
  • -
  • Only role 'europe-user' can create/delete and publish messages to topics whose names match wild-card pattern 'news.europe.#'.
  • -
  • Only role 'news-user' can subscribe messages to topics whose names match wild-card pattern 'news.us.#' and 'news.europe.#'.
  • -
  • For any other topics that don't match any of the above wild-card patterns, permissions are granted to users of role 'user'.
  • - -

    To illustrate the effect of permissions, three topics are deployed. Topic 'genericTopic' matches 'jms.topic.#' wild-card, topic 'news.europe.europeTopic' matches - jms.topic.news.europe.#' wild-cards, and topic 'news.us.usTopic' matches 'jms.topic.news.us.#'.

    - -

    With ActiveMQ Artemis, the security manager is also configurable. You can use JAASSecurityManager or JBossASSecurityManager based on you need. Please - check out the activemq-beans.xml for how to do. In this example we just use the basic ActiveMQSecurityManagerImpl which reads users/roles/passwords from the xml - file activemq-users.xml. - - -

    Example step-by-step

    -

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

    - -
      -
    1. First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the client-jndi.properties file in the directory ../common/config
    2. -
      -           
      -           InitialContext initialContext = getContext(0);
      -           
      -        
      - -
    3. We perform lookup on the topics
    4. -
      -           
      -           Topic genericTopic = (Topic) initialContext.lookup("/topic/genericTopic");
      -           Topic europeTopic = (Topic) initialContext.lookup("/topic/europeTopic");
      -           Topic usTopic = (Topic) initialContext.lookup("/topic/usTopic");
      -           
      -        
      - -
    5. We perform a lookup on the Connection Factory
    6. -
      -           
      -           ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
      -           
      -        
      - -
    7. We try to create a JMS Connection without user/password. It will fail.
    8. -
      -           
      -           try
      -           {
      -              cf.createConnection();
      -              result = false;
      -           }
      -           catch (JMSSecurityException e)
      -           {
      -              System.out.println("Default user cannot get a connection. Details: " + e.getMessage());
      -           }
      -           
      -        
      - -
    9. Bill tries to make a connection using wrong password
    10. -
      -           
      -           billConnection = null;
      -           try
      -           {
      -              billConnection = createConnection("bill", "activemq1", cf);
      -              result = false;
      -           }
      -           catch (JMSException e)
      -           {
      -              System.out.println("User bill failed to connect. Details: " + e.getMessage());
      -           }
      -           
      -        
      - -
    11. Bill makes a good connection.
    12. -
      -          
      -           billConnection = createConnection("bill", "activemq", cf);
      -           billConnection.start();
      -          
      -       
      - -
    13. Andrew makes a good connection
    14. -
      -           
      -           andrewConnection = createConnection("andrew", "activemq1", cf);
      -           andrewConnection.start();
      -           
      -         
      - -
    15. Frank makes a good connection
    16. -
      -           
      -           frankConnection = createConnection("frank", "activemq2", cf);
      -           frankConnection.start();
      -           
      -        
      - -
    17. Sam makes a good connection
    18. -
      -           
      -           samConnection = createConnection("sam", "activemq3", cf);
      -           samConnection.start();
      -           
      -        
      - -
    19. We check every user can publish/subscribe genericTopics
    20. -
      -           
      -           checkUserSendAndReceive(genericTopic, billConnection, "bill");
      -           checkUserSendAndReceive(genericTopic, andrewConnection, "andrew");
      -           checkUserSendAndReceive(genericTopic, frankConnection, "frank");
      -           checkUserSendAndReceive(genericTopic, samConnection, "sam");
      -           
      -        
      - -
    21. We check permissions on news.europe.europeTopic for bill: can't send and can't receive
    22. -
      -           
      -           checkUserNoSendNoReceive(europeTopic, billConnection, "bill", andrewConnection, frankConnection);
      -           
      -        
      - -
    23. We check permissions on news.europe.europeTopic for andrew: can send but can't receive
    24. -
      -           
      -           checkUserSendNoReceive(europeTopic, andrewConnection, "andrew", frankConnection);
      -           
      -        
      - -
    25. We check permissions on news.europe.europeTopic for frank: can't send but can receive
    26. -
      -           
      -           checkUserReceiveNoSend(europeTopic, frankConnection, "frank", andrewConnection);
      -           
      -        
      - -
    27. We check permissions on news.europe.europeTopic for sam: can't send but can receive
    28. -
      -           
      -           checkUserReceiveNoSend(europeTopic, samConnection, "sam", andrewConnection);
      -           
      -        
      - -
    29. We check permissions on news.us.usTopic for bill: can't send and can't receive
    30. -
      -           
      -           checkUserNoSendNoReceive(usTopic, billConnection, "bill");
      -           
      -        
      - -
    31. We check permissions on news.us.usTopic for andrew: can't send and can't receive
    32. -
      -           
      -           checkUserNoSendNoReceive(usTopic, andrewConnection, "andrew");
      -           
      -        
      - -
    33. We check permissions on news.us.usTopic for frank: can both send and receive
    34. -
      -           
      -           checkUserSendAndReceive(usTopic, frankConnection, "frank");
      -           
      -        
      - -
    35. We check permissions on news.us.usTopic for sam: can't send but can receive
    36. -
      -           
      -           checkUserReceiveNoSend(usTopic, samConnection, "sam", frankConnection);
      -           
      -        
      - -
    37. And finally, always remember to close your JMS connections and resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
    38. - -
      -           
      -           finally
      -           {
      -              if (billConnection != null)
      -              {
      -                 billConnection.close();
      -              }
      -              if (andrewConnection != null)
      -              {
      -                 andrewConnection.close();
      -              }
      -              if (frankConnection != null)
      -              {
      -                 frankConnection.close();
      -              }
      -              if (samConnection != null)
      -              {
      -                 samConnection.close();
      -              }
      -
      -              // Also the initialContext
      -              if (initialContext != null)
      -              {
      -                 initialContext.close();
      -              }
      -           }
      -           
      -        
      -
    - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java b/examples/broker-features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java deleted file mode 100644 index 88fd1da..0000000 --- a/examples/broker-features/standard/security/src/main/java/org/apache/activemq/artemis/jms/example/SecurityExample.java +++ /dev/null @@ -1,282 +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.JMSException; -import javax.jms.JMSSecurityException; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.naming.InitialContext; - -public class SecurityExample { - - public static void main(final String[] args) throws Exception { - boolean result = true; - Connection failConnection = null; - Connection billConnection = null; - Connection andrewConnection = null; - Connection frankConnection = null; - Connection samConnection = null; - - InitialContext initialContext = null; - try { - // /Step 1. Create an initial context to perform the JNDI lookup. - initialContext = new InitialContext(); - - // Step 2. perform lookup on the topics - Topic genericTopic = (Topic) initialContext.lookup("topic/genericTopic"); - Topic europeTopic = (Topic) initialContext.lookup("topic/europeTopic"); - Topic usTopic = (Topic) initialContext.lookup("topic/usTopic"); - - // Step 3. perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4. Try to create a JMS Connection without user/password. It will fail. - try { - failConnection = cf.createConnection(); - result = false; - } - catch (JMSSecurityException e) { - System.out.println("Default user cannot get a connection. Details: " + e.getMessage()); - } - - // Step 5. bill tries to make a connection using wrong password - billConnection = null; - try { - billConnection = createConnection("bill", "activemq1", cf); - result = false; - } - catch (JMSException e) { - System.out.println("User bill failed to connect. Details: " + e.getMessage()); - } - - // Step 6. bill makes a good connection. - billConnection = createConnection("bill", "activemq", cf); - billConnection.start(); - - // Step 7. andrew makes a good connection. - andrewConnection = createConnection("andrew", "activemq1", cf); - andrewConnection.start(); - - // Step 8. frank makes a good connection. - frankConnection = createConnection("frank", "activemq2", cf); - frankConnection.start(); - - // Step 9. sam makes a good connection. - samConnection = createConnection("sam", "activemq3", cf); - samConnection.start(); - - // Step 10. Check every user can publish/subscribe genericTopics. - System.out.println("------------------------Checking permissions on " + genericTopic + "----------------"); - checkUserSendAndReceive(genericTopic, billConnection, "bill"); - checkUserSendAndReceive(genericTopic, andrewConnection, "andrew"); - checkUserSendAndReceive(genericTopic, frankConnection, "frank"); - checkUserSendAndReceive(genericTopic, samConnection, "sam"); - System.out.println("-------------------------------------------------------------------------------------"); - - System.out.println("------------------------Checking permissions on " + europeTopic + "----------------"); - - // Step 11. Check permissions on news.europe.europeTopic for bill: can't send and can't receive - checkUserNoSendNoReceive(europeTopic, billConnection, "bill"); - - // Step 12. Check permissions on news.europe.europeTopic for andrew: can send but can't receive - checkUserSendNoReceive(europeTopic, andrewConnection, "andrew", frankConnection); - - // Step 13. Check permissions on news.europe.europeTopic for frank: can't send but can receive - checkUserReceiveNoSend(europeTopic, frankConnection, "frank", andrewConnection); - - // Step 14. Check permissions on news.europe.europeTopic for sam: can't send but can receive - checkUserReceiveNoSend(europeTopic, samConnection, "sam", andrewConnection); - System.out.println("-------------------------------------------------------------------------------------"); - - System.out.println("------------------------Checking permissions on " + usTopic + "----------------"); - - // Step 15. Check permissions on news.us.usTopic for bill: can't send and can't receive - checkUserNoSendNoReceive(usTopic, billConnection, "bill"); - - // Step 16. Check permissions on news.us.usTopic for andrew: can't send and can't receive - checkUserNoSendNoReceive(usTopic, andrewConnection, "andrew"); - - // Step 17. Check permissions on news.us.usTopic for frank: can both send and receive - checkUserSendAndReceive(usTopic, frankConnection, "frank"); - - // Step 18. Check permissions on news.us.usTopic for sam: can't send but can receive - checkUserReceiveNoSend(usTopic, samConnection, "sam", frankConnection); - System.out.println("-------------------------------------------------------------------------------------"); - } - finally { - // Step 19. Be sure to close our JMS resources! - if (failConnection != null) { - failConnection.close(); - } - if (billConnection != null) { - billConnection.close(); - } - if (andrewConnection != null) { - andrewConnection.close(); - } - if (frankConnection != null) { - frankConnection.close(); - } - if (samConnection != null) { - samConnection.close(); - } - - // Also the initialContext - if (initialContext != null) { - initialContext.close(); - } - } - } - - // Check the user can receive message but cannot send message. - private static void checkUserReceiveNoSend(final Topic topic, - final Connection connection, - final String user, - final Connection sendingConn) throws JMSException { - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(topic); - MessageConsumer consumer = session.createConsumer(topic); - TextMessage msg = session.createTextMessage("hello-world-1"); - - try { - producer.send(msg); - throw new IllegalStateException("Security setting is broken! User " + user + - " can send message [" + - msg.getText() + - "] to topic " + - topic); - } - catch (JMSException e) { - System.out.println("User " + user + " cannot send message [" + msg.getText() + "] to topic: " + topic); - } - - // Now send a good message - Session session1 = sendingConn.createSession(false, Session.AUTO_ACKNOWLEDGE); - producer = session1.createProducer(topic); - producer.send(msg); - - TextMessage receivedMsg = (TextMessage) consumer.receive(2000); - - if (receivedMsg != null) { - System.out.println("User " + user + " can receive message [" + receivedMsg.getText() + "] from topic " + topic); - } - else { - throw new IllegalStateException("Security setting is broken! User " + user + " cannot receive message from topic " + topic); - } - - session1.close(); - session.close(); - } - - // Check the user can send message but cannot receive message - private static void checkUserSendNoReceive(final Topic topic, - final Connection connection, - final String user, - final Connection receivingConn) throws JMSException { - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(topic); - try { - session.createConsumer(topic); - } - catch (JMSException e) { - System.out.println("User " + user + " cannot receive any message from topic " + topic); - } - - Session session1 = receivingConn.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer goodConsumer = session1.createConsumer(topic); - - TextMessage msg = session.createTextMessage("hello-world-2"); - producer.send(msg); - - TextMessage receivedMsg = (TextMessage) goodConsumer.receive(2000); - if (receivedMsg != null) { - System.out.println("User " + user + " can send message [" + receivedMsg.getText() + "] to topic " + topic); - } - else { - throw new IllegalStateException("Security setting is broken! User " + user + - " cannot send message [" + - msg.getText() + - "] to topic " + - topic); - } - - session.close(); - session1.close(); - } - - // Check the user has neither send nor receive permission on topic - private static void checkUserNoSendNoReceive(final Topic topic, - final Connection connection, - final String user) throws JMSException { - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(topic); - - try { - session.createConsumer(topic); - } - catch (JMSException e) { - System.out.println("User " + user + " cannot create consumer on topic " + topic); - } - - TextMessage msg = session.createTextMessage("hello-world-3"); - try { - producer.send(msg); - throw new IllegalStateException("Security setting is broken! User " + user + - " can send message [" + - msg.getText() + - "] to topic " + - topic); - } - catch (JMSException e) { - System.out.println("User " + user + " cannot send message [" + msg.getText() + "] to topic: " + topic); - } - - session.close(); - } - - // Check the user connection has both send and receive permissions on the topic - private static void checkUserSendAndReceive(final Topic topic, - final Connection connection, - final String user) throws JMSException { - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - TextMessage msg = session.createTextMessage("hello-world-4"); - MessageProducer producer = session.createProducer(topic); - MessageConsumer consumer = session.createConsumer(topic); - producer.send(msg); - TextMessage receivedMsg = (TextMessage) consumer.receive(5000); - if (receivedMsg != null) { - System.out.println("User " + user + " can send message: [" + msg.getText() + "] to topic: " + topic); - System.out.println("User " + user + " can receive message: [" + msg.getText() + "] from topic: " + topic); - } - else { - throw new IllegalStateException("Error! User " + user + " cannot receive the message! "); - } - session.close(); - } - - private static Connection createConnection(final String username, - final String password, - final ConnectionFactory cf) throws JMSException { - return cf.createConnection(username, password); - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 09b3f5d..0000000 --- a/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-roles.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. -## --------------------------------------------------------------------------- -bill=user -andrew=europe-user,user -frank=us-user,news-user,user -sam=news-user,user \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 0a206c6..0000000 --- a/examples/broker-features/standard/security/src/main/resources/activemq/server0/artemis-users.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. -## --------------------------------------------------------------------------- -bill=activemq -andrew=activemq1 -frank=activemq2 -sam=activemq3 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/security/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/security/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 6a8b82b..0000000 --- a/examples/broker-features/standard/security/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - ${data.dir}/server0/data/messaging/bindings - - ${data.dir}/server0/data/messaging/journal - - ${data.dir}/server0/data/messaging/largemessages - - ${data.dir}/server0/data/messaging/paging - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/security/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/security/src/main/resources/jndi.properties b/examples/broker-features/standard/security/src/main/resources/jndi.properties deleted file mode 100644 index 0a3b640..0000000 --- a/examples/broker-features/standard/security/src/main/resources/jndi.properties +++ /dev/null @@ -1,22 +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/genericTopic=genericTopic -topic.topic/europeTopic=news.europe.europeTopic -topic.topic/usTopic=news.us.usTopic http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/send-acknowledgements/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/send-acknowledgements/pom.xml b/examples/broker-features/standard/send-acknowledgements/pom.xml deleted file mode 100644 index 8295cdc..0000000 --- a/examples/broker-features/standard/send-acknowledgements/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - send-acknowledgements - jar - ActiveMQ Artemis JMS Send Acknowledgements Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - - start - - cli - - - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.SendAcknowledgementsExample - - - - stop - - cli - - - - stop - - - - - - - org.apache.activemq.examples.broker - send-acknowledgements - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/send-acknowledgements/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/send-acknowledgements/readme.html b/examples/broker-features/standard/send-acknowledgements/readme.html deleted file mode 100644 index fcc37fc..0000000 --- a/examples/broker-features/standard/send-acknowledgements/readme.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - ActiveMQ Artemis Asynchronous Send Acknowledgements Example - - - - - -

    Asynchronous Send Acknowledgements 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.
    - - -

    Asynchronous Send Acknowledgements are an advanced feature of ActiveMQ Artemis which allow you to - receive acknowledgements that messages were successfully received at the server in a separate thread to the sending thread

    -

    In this example we create a normal JMS session, then set a SendAcknowledgementHandler on the JMS - session's underlying core session. We send many messages to the server without blocking and asynchronously - receive send acknowledgements via the SendAcknowledgementHandler. - -

    For more information on Asynchronous Send Acknowledgements please see the user manual

    -

    Example step-by-step

    -

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

    - -
      -
    1. First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the client-jndi.properties file in the directory ../common/config
    2. -
      -           InitialContext initialContext = getContext();
      -        
      - -
    3. We look-up the JMS queue object from JNDI
    4. -
      -           Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");
      -        
      - -
    5. We look-up the JMS connection factory object from JNDI
    6. -
      -           ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
      -        
      - -
    7. We create a JMS connection
    8. -
      -           connection = cf.createConnection();
      -        
      - -
    9. Define a SendAcknowledgementHandler which will receive asynchronous acknowledgements
    10. -
      -           
      -         class MySendAcknowledgementsHandler implements SendAcknowledgementHandler
      -         {
      -            int count = 0;
      -
      -            public void sendAcknowledged(final Message message)
      -            {
      -               System.out.println("Received send acknowledgement for message " + count++);
      -            }
      -         }
      -           
      -        
      - -
    11. Create a JMS session
    12. -
      -          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      -       
      - -
    13. Set the handler on the underlying core session
    14. -
      -           
      -         ClientSession coreSession = ((ActiveMQSession)session).getCoreSession();
      -
      -         coreSession.setSendAcknowledgementHandler(new MySendAcknowledgementsHandler());
      -
      -           
      -        
      - -
    15. Create a JMS Message Producer
    16. -
      -           
      -         MessageProducer producer = session.createProducer(queue);
      -
      -         producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      -           
      -        
      - -
    17. Send 5000 messages, the handler will get called asynchronously some time later after the messages are sent.
    18. -
      -           
      -         final int numMessages = 5000;
      -
      -         for (int i = 0; i < numMessages; i++)
      -         {
      -            javax.jms.Message jmsMessage = session.createMessage();
      -
      -            producer.send(jmsMessage);
      -
      -            System.out.println("Sent message " + i);
      -         }
      -           
      -        
      - - -
    19. And finally, always remember to close your JMS connections and resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
    20. - -
      -           finally
      -           {
      -              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/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java b/examples/broker-features/standard/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java deleted file mode 100644 index 578d198..0000000 --- a/examples/broker-features/standard/send-acknowledgements/src/main/java/org/apache/activemq/artemis/jms/example/SendAcknowledgementsExample.java +++ /dev/null @@ -1,104 +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.DeliveryMode; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.naming.InitialContext; - -import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.api.core.client.ClientSession; -import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler; -import org.apache.activemq.artemis.jms.client.ActiveMQSession; - -/** - * Asynchronous Send Acknowledgements are an advanced feature of ActiveMQ Artemis which allow you to - * receive acknowledgements that messages were successfully received at the server in a separate stream - * to the stream of messages being sent to the server. - * For more information please see the readme.html file - */ -public class SendAcknowledgementsExample { - - 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. Define a SendAcknowledgementHandler which will receive asynchronous acknowledgements - class MySendAcknowledgementsHandler implements SendAcknowledgementHandler { - - int count = 0; - - public void sendAcknowledged(final Message message) { - System.out.println("Received send acknowledgement for message " + count++); - } - } - - // Step 6. Create a JMS Session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 7. Set the handler on the underlying core session - - ClientSession coreSession = ((ActiveMQSession) session).getCoreSession(); - - coreSession.setSendAcknowledgementHandler(new MySendAcknowledgementsHandler()); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - - // Step 7. Send 5000 messages, the handler will get called asynchronously some time later after the messages - // are sent. - - final int numMessages = 5000; - - for (int i = 0; i < numMessages; i++) { - javax.jms.Message jmsMessage = session.createMessage(); - - producer.send(jmsMessage); - - System.out.println("Sent message " + i); - } - } - finally { - // Step 12. Be sure to close our JMS 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/send-acknowledgements/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/send-acknowledgements/src/main/resources/jndi.properties b/examples/broker-features/standard/send-acknowledgements/src/main/resources/jndi.properties deleted file mode 100644 index 8421f25..0000000 --- a/examples/broker-features/standard/send-acknowledgements/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?confirmationWindowSize=1048576 -queue.queue/exampleQueue=exampleQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/pom.xml b/examples/broker-features/standard/spring-integration/pom.xml deleted file mode 100644 index 238a550..0000000 --- a/examples/broker-features/standard/spring-integration/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - spring-integration - jar - ActiveMQ Artemis JMS Spring Integration Example - - - ${project.basedir}/../../../.. - - - - - org.apache.activemq - artemis-spring-integration - ${project.version} - - - org.apache.geronimo.specs - geronimo-jms_2.0_spec - - - org.springframework - spring-context - - - - - - - org.apache.activemq - artemis-maven-plugin - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.SpringExample - - - - - - org.apache.activemq.examples.broker - spring-integration - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/readme.html b/examples/broker-features/standard/spring-integration/readme.html deleted file mode 100644 index a3855d0..0000000 --- a/examples/broker-features/standard/spring-integration/readme.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - ActiveMQ Artemis Spring Example - - - - - -

    ActiveMQ Artemis Spring Example

    - -

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

    - -

    Example step-by-step

    -

    YOU MUST DOWNLOAD THE SPRING LIBRARIES TO RUN THIS EXAMPLE!!! You must also modify the build.xml file to include the spring jars. You'll see the placeholder that is already there.

    -

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

    - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/ExampleListener.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/ExampleListener.java b/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/ExampleListener.java deleted file mode 100644 index 3d4e063..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/ExampleListener.java +++ /dev/null @@ -1,37 +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.JMSException; -import javax.jms.Message; -import javax.jms.MessageListener; -import javax.jms.TextMessage; - -public class ExampleListener implements MessageListener { - - protected static String lastMessage = null; - - public void onMessage(Message message) { - try { - lastMessage = ((TextMessage) message).getText(); - } - catch (JMSException e) { - throw new RuntimeException(e); - } - System.out.println("MESSAGE RECEIVED: " + lastMessage); - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/MessageSender.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/MessageSender.java b/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/MessageSender.java deleted file mode 100644 index 594c69b..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/MessageSender.java +++ /dev/null @@ -1,71 +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.Destination; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; - -public class MessageSender { - - private ConnectionFactory connectionFactory; - private Destination destination; - - public ConnectionFactory getConnectionFactory() { - return connectionFactory; - } - - public void setConnectionFactory(ConnectionFactory connectionFactory) { - this.connectionFactory = connectionFactory; - } - - public Destination getDestination() { - return destination; - } - - public void setDestination(Destination destination) { - this.destination = destination; - } - - public void send(String msg) { - Connection conn = null; - try { - conn = connectionFactory.createConnection(); - Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(destination); - TextMessage message = session.createTextMessage(msg); - producer.send(message); - } - catch (Exception ex) { - ex.printStackTrace(); - } - finally { - if (conn != null) { - try { - conn.close(); - } - catch (JMSException e) { - e.printStackTrace(); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/SpringExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/SpringExample.java b/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/SpringExample.java deleted file mode 100644 index cf3ec49..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/java/org/apache/activemq/artemis/jms/example/SpringExample.java +++ /dev/null @@ -1,32 +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.springframework.context.support.ClassPathXmlApplicationContext; - -public class SpringExample { - - public static void main(String[] args) throws Exception { - System.out.println("Creating bean factory..."); - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring-jms-beans.xml"}); - MessageSender sender = (MessageSender) context.getBean("MessageSender"); - System.out.println("Sending message..."); - sender.send("Hello world"); - Thread.sleep(100); - context.destroy(); - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/src/main/resources/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/resources/artemis-roles.properties b/examples/broker-features/standard/spring-integration/src/main/resources/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/resources/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/spring-integration/src/main/resources/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/resources/artemis-users.properties b/examples/broker-features/standard/spring-integration/src/main/resources/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/resources/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/spring-integration/src/main/resources/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/resources/broker.xml b/examples/broker-features/standard/spring-integration/src/main/resources/broker.xml deleted file mode 100644 index 2970329..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/resources/broker.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - false - - - vm://0 - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/spring-integration/src/main/resources/spring-jms-beans.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/spring-integration/src/main/resources/spring-jms-beans.xml b/examples/broker-features/standard/spring-integration/src/main/resources/spring-jms-beans.xml deleted file mode 100644 index a67de73..0000000 --- a/examples/broker-features/standard/spring-integration/src/main/resources/spring-jms-beans.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - guest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/ssl-enabled/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/ssl-enabled/pom.xml b/examples/broker-features/standard/ssl-enabled/pom.xml deleted file mode 100644 index 7a76435..0000000 --- a/examples/broker-features/standard/ssl-enabled/pom.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.broker - jms-examples - 1.0.1-SNAPSHOT - - - ssl-enabled - jar - ActiveMQ Artemis JMS SSL Enabled 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:5500?sslEnabled=true&trustStorePath=activemq/server0/activemq.example.truststore&trustStorePassword=activemqexample - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.SSLExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.broker - ssl-enabled - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/ssl-enabled/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/ssl-enabled/readme.html b/examples/broker-features/standard/ssl-enabled/readme.html deleted file mode 100644 index bb5e724..0000000 --- a/examples/broker-features/standard/ssl-enabled/readme.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - ActiveMQ Artemis JMS SSL Example - - - - - -

    JMS SSL 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 SSL with ActiveMQ Artemis to send and receive message.

    - -

    Using SSL can make your messaging applications interact with ActiveMQ Artemis securely. An application can - be secured transparently without extra coding effort. To secure your messaging application with SSL, you need to configure connector and acceptor as follows:

    - -

    -

    -           
    -      <!-- Connector -->
    -
    -      <connector name="netty-ssl-connector">tcp://localhost:5500?sslEnabled=true;keyStorePath=activemq/server0/activemq.example.keystore;keyStorePassword=activemqexample</connector>
    -
    -      <!-- Acceptor -->
    -
    -      <acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;keyStorePath=activemq/server0/activemq.example.keystore;keyStorePassword=activemqexample</acceptor>
    -
    -           
    -        
    -

    - -

    In the configuration, the activemq.example.keystore is the key store file holding the server's certificate. The activemq.example.truststore - is the file holding the certificates which the client trusts (i.e. the server's certificate exported from activemq.example.keystore). They are pre-generated for illustration purpose1.

    - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java b/examples/broker-features/standard/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.java deleted file mode 100644 index 27bf739..0000000 --- a/examples/broker-features/standard/ssl-enabled/src/main/java/org/apache/activemq/artemis/jms/example/SSLExample.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 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; - -/** - * A simple JMS Queue example that uses SSL secure transport. - */ -public class SSLExample { - - 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. 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()); - - initialContext.close(); - } - finally { - // Step 12. Be sure to close our JMS resources! - if (initialContext != null) { - initialContext.close(); - } - if (connection != null) { - connection.close(); - } - } - } -}