You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2016/06/07 09:26:08 UTC

[1/2] activemq-artemis git commit: Update embedded docs/example

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 50d83fb63 -> a67838bc3


Update embedded docs/example


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

Branch: refs/heads/master
Commit: 1e28b3e7e7f7263744c55e106ae4feed50a5f94c
Parents: 50d83fb
Author: jbertram <jb...@apache.org>
Authored: Mon Jun 6 17:00:00 2016 -0500
Committer: jbertram <jb...@apache.org>
Committed: Mon Jun 6 17:30:12 2016 -0500

----------------------------------------------------------------------
 docs/user-manual/en/embedding-activemq.md       | 49 +++++++++++---------
 .../artemis/jms/example/EmbeddedExample.java    | 37 ++++++++-------
 2 files changed, 46 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1e28b3e7/docs/user-manual/en/embedding-activemq.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/embedding-activemq.md b/docs/user-manual/en/embedding-activemq.md
index 79f2491..66c897b 100644
--- a/docs/user-manual/en/embedding-activemq.md
+++ b/docs/user-manual/en/embedding-activemq.md
@@ -72,10 +72,9 @@ properties. See the javadocs for this class for more details.
 ## JMS API
 
 JMS embedding is simple as well. This example requires that you have
-defined the config files `broker.xml`,
-`activemq-jms.xml`, and a `activemq-users.xml` if you have security
-enabled. Let's also assume that a queue and connection factory has been
-defined in the `activemq-jms.xml` config file.
+defined the config file `broker.xml`. Let's also assume that a queue
+and connection factory has been defined in the `broker.xml` 
+config file as well.
 
 ``` java
 import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
@@ -85,19 +84,19 @@ import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
 EmbeddedJMS jms = new EmbeddedJMS();
 jms.start();
 
-// This assumes we have configured activemq-jms.xml with the appropriate config information
+// This assumes we have configured broker.xml with the appropriate config information
 ConnectionFactory connectionFactory = jms.lookup("ConnectionFactory");
 Destination destination = jms.lookup("/example/queue");
 
 ... regular JMS code ...
 ```
 
-By default, the `EmbeddedJMS` class will store component entries defined
-within your `activemq-jms.xml` file in an internal concurrent hash map.
-The `EmbeddedJMS.lookup()` method returns components stored in this map.
-If you want to use JNDI, call the `EmbeddedJMS.setContext()` method with
-the root JNDI context you want your components bound into. See the
-javadocs for this class for more details on other config options.
+By default, the `EmbeddedJMS` class will store the "entries" defined for
+your JMS components within `broker.xml` in an internal concurrent hash
+map. The `EmbeddedJMS.lookup()` method returns components stored in
+this map. If you want to use JNDI, call the `EmbeddedJMS.setContext()` 
+method with the root JNDI context you want your components bound into. 
+See the JavaDocs for this class for more details on other config options.
 
 ## POJO instantiation - Embedding Programmatically
 
@@ -159,28 +158,34 @@ an example of this:
 
 ``` java
 // Step 1. Create Apache ActiveMQ Artemis core configuration, and set the properties accordingly
-Configuration configuration = new ConfigurationImpl();
-configuration.setPersistenceEnabled(false);
-configuration.setSecurityEnabled(false);
-configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
+Configuration configuration = new ConfigurationImpl()
+   .setPersistenceEnabled(false)
+   .setSecurityEnabled(false)
+   .addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName()))
+   .addConnectorConfiguration("myConnector", new TransportConfiguration(NettyAcceptorFactory.class.getName()));
 
 // Step 2. Create the JMS configuration
 JMSConfiguration jmsConfig = new JMSConfigurationImpl();
 
 // Step 3. Configure the JMS ConnectionFactory
-TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
-ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl("cf", connectorConfig, "/cf");
+ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl()
+   .setName("cf")
+   .setConnectorNames(Arrays.asList("myConnector"))
+   .setBindings("/cf");
 jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
 
 // Step 4. Configure the JMS Queue
-JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl("queue1", null, false, "/queue/queue1");
+JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl()
+   .setName("queue1")
+   .setDurable(false)
+   .setBindings("/queue/queue1");
 jmsConfig.getQueueConfigurations().add(queueConfig);
 
 // Step 5. Start the JMS Server using the Apache ActiveMQ Artemis core server and the JMS configuration
-EmbeddedJMS jmsServer = new EmbeddedJMS();
-jmsServer.setConfiguration(configuration);
-jmsServer.setJmsConfiguration(jmsConfig);
-jmsServer.start();
+jmsServer = new EmbeddedJMS()
+   .setConfiguration(configuration)
+   .setJmsConfiguration(jmsConfig)
+   .start();
 ```
 
 Please see the examples for an example which shows how to setup and run Apache ActiveMQ Artemis

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1e28b3e7/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
index 9cdc504..6118ea9 100644
--- a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
+++ b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -23,8 +23,8 @@ 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.Arrays;
 
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
@@ -46,34 +46,35 @@ 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);
+      Configuration configuration = new ConfigurationImpl()
+         .setPersistenceEnabled(false)
+         .setJournalDirectory("target/data/journal")
+         .setSecurityEnabled(false)
+         .addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName()))
+         .addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName()));
 
       // Step 2. Create the JMS configuration
       JMSConfiguration jmsConfig = new JMSConfigurationImpl();
 
       // Step 3. Configure the JMS ConnectionFactory
-      ArrayList<String> connectorNames = new ArrayList<>();
-      connectorNames.add("connector");
-      ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(connectorNames).setBindings("cf");
+      ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl()
+         .setName("cf")
+         .setConnectorNames(Arrays.asList("connector"))
+         .setBindings("cf");
       jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
 
       // Step 4. Configure the JMS Queue
-      JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1");
+      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();
+      EmbeddedJMS jmsServer = new EmbeddedJMS()
+         .setConfiguration(configuration)
+         .setJmsConfiguration(jmsConfig)
+         .start();
       System.out.println("Started Embedded JMS Server");
 
       // Step 6. Lookup JMS resources defined in the configuration


[2/2] activemq-artemis git commit: This closes #564

Posted by ma...@apache.org.
This closes #564


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

Branch: refs/heads/master
Commit: a67838bc3b07b4ef27867c6e9517f83830defe45
Parents: 50d83fb 1e28b3e
Author: Martyn Taylor <mt...@redhat.com>
Authored: Tue Jun 7 10:25:45 2016 +0100
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Tue Jun 7 10:25:45 2016 +0100

----------------------------------------------------------------------
 docs/user-manual/en/embedding-activemq.md       | 49 +++++++++++---------
 .../artemis/jms/example/EmbeddedExample.java    | 37 ++++++++-------
 2 files changed, 46 insertions(+), 40 deletions(-)
----------------------------------------------------------------------