http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/etc/org.eclipse.jdt.ui.prefs
----------------------------------------------------------------------
diff --git a/etc/org.eclipse.jdt.ui.prefs b/etc/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..f68cb8d
--- /dev/null
+++ b/etc/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,119 @@
+#Thu Nov 10 13:53:54 CET 2011
+cleanup.add_default_serial_version_id=false
+cleanup.add_generated_serial_version_id=true
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=false
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=true
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=true
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_HornetQ profile
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_'HornetQ'
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;com;org;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=9999
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=9999
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" 
encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" 
context\="gettercomment_context" deleted\="false" description\="Comment for 
getter method" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" 
name\="gettercomment">/**\n * @return the ${bare_field_name}\n 
*/</template><template autoinsert\="true" context\="settercomment_context" 
deleted\="false" description\="Comment for setter method" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" 
name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n 
*/</template><template autoinsert\="true" context\="constructorcomment_context" 
deleted\="false" description\="Comment for created constructors" 
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" 
name\="constructorcomment">/**\n * ${tags}\n */</template><template 
autoinsert\="true" context\="filecomment_context"
  deleted\="false" description\="Comment for created Java files" 
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" 
name\="filecomment">/**\n * \n */</template><template autoinsert\="false" 
context\="typecomment_context" deleted\="false" description\="Comment for 
created types" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" 
name\="typecomment">/**\n * ${tags}\n */</template><template autoinsert\="true" 
context\="fieldcomment_context" deleted\="false" description\="Comment for 
fields" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" 
name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" 
context\="methodcomment_context" deleted\="false" description\="Comment for 
non-overriding methods" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" 
name\="methodcomment">/**\n * ${tags}\n */</template><template 
autoinsert\="false" context\="overridecomment_context" deleted\="false" descrip
 tion\="Comment for overriding methods" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" 
name\="overridecomment"/><template autoinsert\="true" 
context\="delegatecomment_context" deleted\="false" description\="Comment for 
delegate methods" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" 
name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n 
*/</template><template autoinsert\="true" context\="newtype_context" 
deleted\="false" description\="Newly created files" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.newtype" 
name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template
 autoinsert\="true" context\="classbody_context" deleted\="false" 
description\="Code in new class type bodies" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.classbody" 
name\="classbody">\n</template><template autoinsert\="true" 
context\="interfacebody_context" deleted\="false" 
 description\="Code in new interface type bodies" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" 
name\="interfacebody">\n</template><template autoinsert\="true" 
context\="enumbody_context" deleted\="false" description\="Code in new enum 
type bodies" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" 
name\="enumbody">\n</template><template autoinsert\="true" 
context\="annotationbody_context" deleted\="false" description\="Code in new 
annotation type bodies" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" 
name\="annotationbody">\n</template><template autoinsert\="true" 
context\="catchblock_context" deleted\="false" description\="Code in new catch 
blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" 
name\="catchblock">// ${todo} Auto-generated catch 
block\n${exception_var}.printStackTrace();</template><template 
autoinsert\="true" context\="methodbody_context" deleted\="false" description\="
 Code in created method stubs" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// 
${todo} Auto-generated method stub\n${body_statement}</template><template 
autoinsert\="true" context\="constructorbody_context" deleted\="false" 
description\="Code in created constructor stubs" enabled\="true" 
id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" 
name\="constructorbody">${body_statement}\n// ${todo} Auto-generated 
constructor stub</template><template autoinsert\="true" 
context\="getterbody_context" deleted\="false" description\="Code in created 
getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" 
name\="getterbody">return ${field};</template><template autoinsert\="true" 
context\="setterbody_context" deleted\="false" description\="Code in created 
setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" 
name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=false
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded-remote/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/embedded-remote/pom.xml 
b/examples/core/embedded-remote/pom.xml
new file mode 100644
index 0000000..c88da36
--- /dev/null
+++ b/examples/core/embedded-remote/pom.xml
@@ -0,0 +1,113 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.hornetq.examples.core</groupId>
+      <artifactId>core-examples</artifactId>
+      <version>2.5.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>hornetq-core-embedded-remote-example</artifactId>
+   <packaging>jar</packaging>
+   <name>HornetQ Core Embedded Remote Example</name>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-core-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>io.netty</groupId>
+         <artifactId>netty-all</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-jms-api</artifactId>
+         <version>1.1.0.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.naming</groupId>
+         <artifactId>jnp-client</artifactId>
+         <version>5.0.5.Final</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.jms</groupId>
+         <artifactId>jboss-jms-api_2.0_spec</artifactId>
+      </dependency>
+   </dependencies>
+
+   <profiles>
+      <profile>
+         <id>server</id>
+         <dependencies>
+            <dependency>
+               <groupId>org.hornetq</groupId>
+               <artifactId>hornetq-server</artifactId>
+               <version>${project.version}</version>
+            </dependency>
+         </dependencies>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     
<mainClass>org.hornetq.core.example.EmbeddedServer</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>client</id>
+         <dependencies>
+            <dependency>
+               <groupId>org.hornetq</groupId>
+               <artifactId>hornetq-core-client</artifactId>
+               <version>${project.version}</version>
+            </dependency>
+         </dependencies>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     
<mainClass>org.hornetq.core.example.EmbeddedRemoteExample</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded-remote/readme.html
----------------------------------------------------------------------
diff --git a/examples/core/embedded-remote/readme.html 
b/examples/core/embedded-remote/readme.html
new file mode 100644
index 0000000..ad25345
--- /dev/null
+++ b/examples/core/embedded-remote/readme.html
@@ -0,0 +1,85 @@
+<html>
+  <head>
+    <title>HornetQ Embedded Example</title>
+    <link rel="stylesheet" type="text/css" href="../../common/common.css" />
+    <link rel="stylesheet" type="text/css" href="../../common/prettify.css" />
+    <script type="text/javascript" src="../../common/prettify.js"></script>
+  </head>
+  <body onload="prettyPrint()">
+     <h1>Embedded Example</h1>
+     <p>This example shows how to setup and run HornetQ embedded with remote 
clients connecting.</p>
+     <p>HornetQ was designed to use POJOs (Plain Old Java Objects), what makes 
embedding HornetQ as simple as instantiating a few objects.</p>
+
+     <p>HornetQ Embedded could be used from very simple use cases with only 
InVM support to very complex cases with clustering, persistence and fail 
over.</p>
+
+
+     <h2>Example step-by-step</h2>     
+     <p><i>To run the example, simply type <code>mvn -Pserver</code> from this 
directory to start the server and <code>mvn -Pclient</code> to run the client 
example</i></p>
+     <p>In this we don't use any configuration files. (Everything is 
embedded). We simply instantiate ConfigurationImpl, HornetQServer, start it and 
operate on JMS regularly</p>
+     <br/>
+     <ol>
+        <li>On EmbeddedServer: Create the Configuration, and set the 
properties accordingly</li>
+        <pre class="prettyprint">
+           Configuration configuration = new ConfigurationImpl();
+           configuration.setEnablePersistence(false);
+           configuration.setSecurityEnabled(false);
+        </pre>
+         
+        <li>On EmbeddedServer: Create and start the server</li>
+        <pre class="prettyprint">
+           HornetQServer server = HornetQ.newHornetQServer(configuration);
+           server.start();
+        </pre>
+
+        <li>As we are not using a JNDI environment we instantiate the objects 
directly</li>
+        <pre class="prettyprint">
+           ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(NettyConnectorFactory.class.getName()));
+           ClientSessionFactory sf = serverLocator.createSessionFactory();
+        </pre>
+
+        <li>Create a Core Queue</li>
+        <pre class="prettyprint">
+           ClientSession coreSession = sf.createSession(false, false, false);
+           final String queueName = "queue.exampleQueue";
+           coreSession.createQueue(queueName, queueName, true);
+           coreSession.close();
+        </pre>
+
+        <li>Create the session and producer</li>
+        <pre class="prettyprint">
+           session = sf.createSession();
+                                   
+           ClientProducer producer = session.createProducer(queueName);
+        </pre>
+
+        <li>Create and send a Message</li>
+        <pre class="prettyprint">
+           ClientMessage message = session.createMessage(false);
+           message.putStringProperty(propName, "Hello sent at " + new Date());
+           System.out.println("Sending the message.");
+           producer.send(message);
+        </pre>
+
+        <li>Create the message consumer and start the connection</li>
+        <pre class="prettyprint">
+           ClientConsumer messageConsumer = session.createConsumer(queueName);
+           session.start();
+        </pre>
+
+        <li>Receive the message</li>
+        <pre class="prettyprint">
+           ClientMessage messageReceived = messageConsumer.receive(1000);
+           System.out.println("Received TextMessage:" + 
messageReceived.getProperty(propName));
+        </pre>
+
+        <li>Be sure to close our resources!</li>
+
+        <pre class="prettyprint">
+           if (sf != null)
+           {
+              sf.close();
+           }
+        </pre>
+     </ol>
+  </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedRemoteExample.java
----------------------------------------------------------------------
diff --git 
a/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedRemoteExample.java
 
b/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedRemoteExample.java
new file mode 100644
index 0000000..95a5a6e
--- /dev/null
+++ 
b/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedRemoteExample.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+
+/**
+ *
+ * This example shows how to run a HornetQ core client and server embedded in 
your
+ * own application
+ *
+ * @author <a href="mailto:tim....@jboss.com";>Tim Fox</a>
+ *
+ */
+public class EmbeddedRemoteExample
+{
+
+   public static void main(final String[] args)
+   {
+      try
+      {
+         // Step 3. As we are not using a JNDI environment we instantiate the 
objects directly
+
+         /**
+          * this map with configuration values is not necessary (it configures 
the default values).
+          * If you modify it to run the example in two different hosts, 
remember to also modify the
+          * server's Acceptor at {@link EmbeddedServer}
+          */
+         Map<String,Object> map = new HashMap<String,Object>();
+         map.put("host", "localhost");
+         map.put("port", 5445);
+         // -------------------------------------------------------
+
+         ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(NettyConnectorFactory.class.getName(), map));
+         ClientSessionFactory sf = serverLocator.createSessionFactory();
+
+         // Step 4. Create a core queue
+         ClientSession coreSession = sf.createSession(false, false, false);
+
+         final String queueName = "queue.exampleQueue";
+
+         coreSession.createQueue(queueName, queueName, true);
+
+         coreSession.close();
+
+         ClientSession session = null;
+
+         try
+         {
+
+            // Step 5. Create the session, and producer
+            session = sf.createSession();
+
+            ClientProducer producer = session.createProducer(queueName);
+
+            // Step 6. Create and send a message
+            ClientMessage message = session.createMessage(false);
+
+            final String propName = "myprop";
+
+            message.putStringProperty(propName, "Hello sent at " + new Date());
+
+            System.out.println("Sending the message.");
+
+            producer.send(message);
+
+            // Step 7. Create the message consumer and start the connection
+            ClientConsumer messageConsumer = session.createConsumer(queueName);
+            session.start();
+
+            // Step 8. Receive the message.
+            ClientMessage messageReceived = messageConsumer.receive(1000);
+            System.out.println("Received TextMessage:" + 
messageReceived.getStringProperty(propName));
+         }
+         finally
+         {
+            // Step 9. Be sure to close our resources!
+            if (sf != null)
+            {
+               sf.close();
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedServer.java
----------------------------------------------------------------------
diff --git 
a/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedServer.java
 
b/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedServer.java
new file mode 100644
index 0000000..baaf917
--- /dev/null
+++ 
b/examples/core/embedded-remote/src/main/java/org/hornetq/core/example/EmbeddedServer.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+
+/**
+ * An EmbeddedServer
+ * @author <a href="mailto:clebert.suco...@jboss.org";>Clebert Suconic</a>
+ */
+public class EmbeddedServer
+{
+
+       public static void main(final String arg[]) throws Exception
+   {
+      try
+      {
+         // Step 1. Create the Configuration, and set the properties 
accordingly
+         Configuration configuration = new ConfigurationImpl();
+         //we only need this for the server lock file
+         configuration.setJournalDirectory("target/data/journal");
+         configuration.setPersistenceEnabled(false);
+         configuration.setSecurityEnabled(false);
+         /**
+          * this map with configuration values is not necessary (it configures 
the default values).
+          * If you want to modify it to run the example in two different 
hosts, remember to also
+          * modify the client's Connector at {@link EmbeddedRemoteExample}.
+          */
+         Map<String, Object> map = new HashMap<String, Object>();
+         map.put("host", "localhost");
+         map.put("port", 5445);
+
+         TransportConfiguration transpConf = new 
TransportConfiguration(NettyAcceptorFactory.class.getName(),map);
+
+         HashSet<TransportConfiguration> setTransp = new 
HashSet<TransportConfiguration>();
+         setTransp.add(transpConf);
+
+         configuration.setAcceptorConfigurations(setTransp);
+
+         // Step 2. Create and start the server
+         HornetQServer server = HornetQServers.newHornetQServer(configuration);
+         server.start();
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         throw e;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/embedded/pom.xml b/examples/core/embedded/pom.xml
new file mode 100644
index 0000000..d6b92b4
--- /dev/null
+++ b/examples/core/embedded/pom.xml
@@ -0,0 +1,78 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.hornetq.examples.core</groupId>
+      <artifactId>core-examples</artifactId>
+      <version>2.5.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>hornetq-core-embedded-example</artifactId>
+   <packaging>jar</packaging>
+   <name>HornetQ Core Embedded Example</name>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-core-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>io.netty</groupId>
+         <artifactId>netty-all</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-jms-api</artifactId>
+         <version>1.1.0.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.naming</groupId>
+         <artifactId>jnp-client</artifactId>
+         <version>5.0.5.Final</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.jms</groupId>
+         <artifactId>jboss-jms-api_2.0_spec</artifactId>
+      </dependency>
+   </dependencies>
+
+   <profiles>
+      <profile>
+         <id>example</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     
<mainClass>org.hornetq.core.example.EmbeddedExample</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded/readme.html
----------------------------------------------------------------------
diff --git a/examples/core/embedded/readme.html 
b/examples/core/embedded/readme.html
new file mode 100644
index 0000000..ac41734
--- /dev/null
+++ b/examples/core/embedded/readme.html
@@ -0,0 +1,97 @@
+<html>
+  <head>
+    <title>HornetQ Embedded Example</title>
+    <link rel="stylesheet" type="text/css" href="../../common/common.css" />
+    <link rel="stylesheet" type="text/css" href="../../common/prettify.css" />
+    <script type="text/javascript" src="../../common/prettify.js"></script>
+  </head>
+  <body onload="prettyPrint()">
+     <h1>Embedded Example</h1>
+
+     <p>This example shows how to setup and run HornetQ embedded.</p>
+     <p>HornetQ was designed to use POJOs (Plain Old Java Objects), what makes 
embedding HornetQ as simple as instantiating a few objects.</p>
+     <p>In this example, we are using two jars:</p>
+     <ul>
+        <li>hornetq-server.jar</li>
+        <li>netty.jar</li>
+     </ul>
+     
+     <p>HornetQ Embedded could be used from very simple use cases with only 
InVM support to very complex cases with clustering, persistence and fail 
over.</p>
+
+     <h2>Example step-by-step</h2>     
+     <p><i>To run the example, simply type <code>mvn -Pexample</code> from 
this directory</i></p>
+     <p>In this we don't use any configuration files. (Everything is 
embedded). We simply instantiate ConfigurationImpl, HornetQServer, start it and 
operate on JMS regularly</p>
+
+     <ol>
+        <li>Create the Configuration, and set the properties accordingly</li>
+        <pre class="prettyprint">
+           Configuration configuration = new ConfigurationImpl();
+           configuration.setEnablePersistence(false);
+           configuration.setSecurityEnabled(false);
+           configuration.getAcceptorConfigurations().add(new 
TransportConfiguration(InVMAcceptorFactory.class.getName()));
+        </pre>
+         
+        <li>Create and start the server</li>
+        <pre class="prettyprint">
+           HornetQServer server = HornetQ.newHornetQServer(configuration);
+           server.start();
+        </pre>
+
+        <li>As we are not using a JNDI environment we instantiate the objects 
directly</li>
+        <pre class="prettyprint">
+           ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(InVMConnectorFactory.class.getName()));
+           ClientSessionFactory sf = serverLocator.createSessionFactory();
+        </pre>
+
+        <li>Create a Core Queue</li>
+        <pre class="prettyprint">
+           ClientSession coreSession = sf.createSession(false, false, false);
+           final String queueName = "queue.exampleQueue";
+           coreSession.createQueue(queueName, queueName, true);
+           coreSession.close();
+        </pre>
+
+        <li>Create the session and producer</li>
+        <pre class="prettyprint">
+            session = sf.createSession();
+                                   
+            ClientProducer producer = session.createProducer(queueName);
+        </pre>
+
+        <li>Create and send a Message</li>
+        <pre class="prettyprint">
+           ClientMessage message = session.createMessage(false);
+           message.putStringProperty(propName, "Hello sent at " + new Date());
+           System.out.println("Sending the message.");
+           producer.send(message);
+        </pre>
+
+        <li>Create the message consumer and start the connection</li>
+        <pre class="prettyprint">
+           ClientConsumer messageConsumer = session.createConsumer(queueName);
+           session.start();
+        </pre>
+
+        <li>Receive the message</li>
+        <pre class="prettyprint">
+           ClientMessage messageReceived = messageConsumer.receive(1000);
+           System.out.println("Received TextMessage:" + 
messageReceived.getProperty(propName));
+        </pre>
+
+        <li>Be sure to close our resources!</li>
+
+        <pre class="prettyprint">
+           if (sf != null)
+           {
+              sf.close();
+           }
+        </pre>
+
+        <li>Stop the server</li>
+
+        <pre class="prettyprint">
+           server.stop();
+        </pre>
+     </ol>
+  </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/embedded/src/main/java/org/hornetq/core/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git 
a/examples/core/embedded/src/main/java/org/hornetq/core/example/EmbeddedExample.java
 
b/examples/core/embedded/src/main/java/org/hornetq/core/example/EmbeddedExample.java
new file mode 100644
index 0000000..96e3b02
--- /dev/null
+++ 
b/examples/core/embedded/src/main/java/org/hornetq/core/example/EmbeddedExample.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.util.Date;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+
+/**
+ *
+ * This example shows how to run a HornetQ core client and server embedded in 
your
+ * own application
+ *
+ * @author <a href="mailto:tim....@jboss.com";>Tim Fox</a>
+ *
+ */
+public class EmbeddedExample
+{
+
+   public static void main(final String[] args) throws Exception
+   {
+      try
+      {
+         // Step 1. Create the Configuration, and set the properties 
accordingly
+         Configuration configuration = new ConfigurationImpl();
+         //we only need this for the server lock file
+         configuration.setJournalDirectory("target/data/journal");
+         configuration.setPersistenceEnabled(false);
+         configuration.setSecurityEnabled(false);
+         configuration.getAcceptorConfigurations().add(new 
TransportConfiguration(InVMAcceptorFactory.class.getName()));
+
+         // Step 2. Create and start the server
+         HornetQServer server = HornetQServers.newHornetQServer(configuration);
+         server.start();
+
+         // Step 3. As we are not using a JNDI environment we instantiate the 
objects directly
+         ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(InVMConnectorFactory.class.getName()));
+         ClientSessionFactory sf = serverLocator.createSessionFactory();
+
+         // Step 4. Create a core queue
+         ClientSession coreSession = sf.createSession(false, false, false);
+
+         final String queueName = "queue.exampleQueue";
+
+         coreSession.createQueue(queueName, queueName, true);
+
+         coreSession.close();
+
+         ClientSession session = null;
+
+         try
+         {
+
+            // Step 5. Create the session, and producer
+            session = sf.createSession();
+
+            ClientProducer producer = session.createProducer(queueName);
+
+            // Step 6. Create and send a message
+            ClientMessage message = session.createMessage(false);
+
+            final String propName = "myprop";
+
+            message.putStringProperty(propName, "Hello sent at " + new Date());
+
+            System.out.println("Sending the message.");
+
+            producer.send(message);
+
+            // Step 7. Create the message consumer and start the connection
+            ClientConsumer messageConsumer = session.createConsumer(queueName);
+            session.start();
+
+            // Step 8. Receive the message.
+            ClientMessage messageReceived = messageConsumer.receive(1000);
+            System.out.println("Received TextMessage:" + 
messageReceived.getStringProperty(propName));
+         }
+         finally
+         {
+            // Step 9. Be sure to close our resources!
+            if (sf != null)
+            {
+               sf.close();
+            }
+
+            // Step 10. Stop the server
+            server.stop();
+         }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         throw e;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/microcontainer/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/microcontainer/pom.xml 
b/examples/core/microcontainer/pom.xml
new file mode 100644
index 0000000..f3d92f5
--- /dev/null
+++ b/examples/core/microcontainer/pom.xml
@@ -0,0 +1,84 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.hornetq.examples.core</groupId>
+      <artifactId>core-examples</artifactId>
+      <version>2.5.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>hornetq-core-microcontainer-example</artifactId>
+   <packaging>jar</packaging>
+   <name>HornetQ Core Microcontainer Example</name>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-bootstrap</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-core-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>io.netty</groupId>
+         <artifactId>netty-all</artifactId>
+         <version>${netty.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-jms-api</artifactId>
+         <version>1.1.0.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.naming</groupId>
+         <artifactId>jnp-client</artifactId>
+         <version>5.0.5.Final</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.jms</groupId>
+         <artifactId>jboss-jms-api_2.0_spec</artifactId>
+      </dependency>
+   </dependencies>
+
+   <profiles>
+      <profile>
+         <id>example</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     
<mainClass>org.hornetq.core.example.EmbeddedMicroContainerExample</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/microcontainer/readme.html
----------------------------------------------------------------------
diff --git a/examples/core/microcontainer/readme.html 
b/examples/core/microcontainer/readme.html
new file mode 100644
index 0000000..40d2832
--- /dev/null
+++ b/examples/core/microcontainer/readme.html
@@ -0,0 +1,82 @@
+<html>
+  <head>
+    <title>HornetQ Embedded Example</title>
+    <link rel="stylesheet" type="text/css" href="../../common/common.css" />
+    <link rel="stylesheet" type="text/css" href="../../common/prettify.css" />
+    <script type="text/javascript" src="../../common/prettify.js"></script>
+  </head>
+  <body onload="prettyPrint()">
+     <h1>Micro Container Example</h1>
+
+     <p>This examples shows how to setup and run HornetQ through the Micro 
Container.</p>
+     <p>Refer to the user's manual for the list of required Jars, since JBoss 
Micro Container requires a few jars.</p>
+     <h2>Example step-by-step</h2>     
+     <p><i>To run the example, simply type <code>mvn verify</code> from this 
directory</i></p>
+     <p>In this we don't use any configuration files. (Everything is 
embedded). We simply instantiate ConfigurationImpl, HornetQServer, start it and 
operate on JMS regularly</p>
+
+     <ol>
+     
+        <li>Start the server</li>
+        <pre class="prettyprint">
+           hornetq = new HornetQBootstrapServer("./server0/hornetq-beans.xml");
+           hornetq.run();
+        </pre>
+     
+        <li>As we are not using a JNDI environment we instantiate the objects 
directly</li>
+        <pre class="prettyprint">
+           ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(NettyConnectorFactory.class.getName()));
+           ClientSessionFactory sf = serverLocator.createSessionFactory();
+        </pre>
+
+        <li>Create a Core Queue</li>
+        <pre class="prettyprint">
+           ClientSession coreSession = sf.createSession(false, false, false);
+           final String queueName = "queue.exampleQueue";
+           coreSession.createQueue(queueName, queueName, true);
+           coreSession.close();
+        </pre>
+
+        <li>Create the session and producer</li>
+        <pre class="prettyprint">
+           session = sf.createSession();
+                                   
+           ClientProducer producer = session.createProducer(queueName);
+        </pre>
+
+        <li>Create and send a Message</li>
+        <pre class="prettyprint">
+           ClientMessage message = session.createMessage(false);
+           message.putStringProperty(propName, "Hello sent at " + new Date());
+           System.out.println("Sending the message.");
+           producer.send(message);
+        </pre>
+
+        <li>Create the message consumer and start the connection</li>
+        <pre class="prettyprint">
+           ClientConsumer messageConsumer = session.createConsumer(queueName);
+           session.start();
+        </pre>
+
+        <li>Receive the message</li>
+        <pre class="prettyprint">
+           ClientMessage messageReceived = messageConsumer.receive(1000);
+           System.out.println("Received TextMessage:" + 
messageReceived.getProperty(propName));
+         </pre>
+
+        <li>Be sure to close our resources!</li>
+
+        <pre class="prettyprint">
+           if (sf != null)
+           {
+              sf.close();
+           }
+        </pre>
+
+        <li>Stop the server</li>
+
+        <pre class="prettyprint">
+           hornetq.shutdown();
+        </pre>
+     </ol>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/microcontainer/src/main/java/org/hornetq/core/example/EmbeddedMicroContainerExample.java
----------------------------------------------------------------------
diff --git 
a/examples/core/microcontainer/src/main/java/org/hornetq/core/example/EmbeddedMicroContainerExample.java
 
b/examples/core/microcontainer/src/main/java/org/hornetq/core/example/EmbeddedMicroContainerExample.java
new file mode 100644
index 0000000..ac5ace4
--- /dev/null
+++ 
b/examples/core/microcontainer/src/main/java/org/hornetq/core/example/EmbeddedMicroContainerExample.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.util.Date;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.*;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.integration.bootstrap.HornetQBootstrapServer;
+
+/**
+ *
+ * This example shows how to run a HornetQ core client and server embedded in 
your
+ * own application
+ *
+ * @author <a href="mailto:tim....@jboss.com";>Tim Fox</a>
+ *
+ */
+public class EmbeddedMicroContainerExample
+{
+
+   public static void main(final String[] args) throws Exception
+   {
+
+      HornetQBootstrapServer hornetQ = null;
+      try
+      {
+
+         // Step 1. Start the server
+         hornetQ = new HornetQBootstrapServer("hornetq-beans.xml");
+         hornetQ.run();
+
+         // Step 2. As we are not using a JNDI environment we instantiate the 
objects directly
+         ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(NettyConnectorFactory.class.getName()));
+         ClientSessionFactory sf = serverLocator.createSessionFactory();
+
+         // Step 3. Create a core queue
+         ClientSession coreSession = sf.createSession(false, false, false);
+
+         final String queueName = "queue.exampleQueue";
+
+         coreSession.createQueue(queueName, queueName, true);
+
+         coreSession.close();
+
+         ClientSession session = null;
+
+         try
+         {
+
+            // Step 4. Create the session, and producer
+            session = sf.createSession();
+
+            ClientProducer producer = session.createProducer(queueName);
+
+            // Step 5. Create and send a message
+            ClientMessage message = session.createMessage(false);
+
+            final String propName = "myprop";
+
+            message.putStringProperty(propName, "Hello sent at " + new Date());
+
+            System.out.println("Sending the message.");
+
+            producer.send(message);
+
+            // Step 6. Create the message consumer and start the connection
+            ClientConsumer messageConsumer = session.createConsumer(queueName);
+            session.start();
+
+            // Step 7. Receive the message.
+            ClientMessage messageReceived = messageConsumer.receive(1000);
+
+            System.out.println("Received TextMessage:" + 
messageReceived.getStringProperty(propName));
+         }
+         finally
+         {
+            // Step 8. Be sure to close our resources!
+            if (sf != null)
+            {
+               sf.close();
+            }
+
+            // Step 9. Shutdown the container
+            if (hornetQ != null)
+            {
+               hornetQ.shutDown();
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         throw e;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/microcontainer/src/main/resources/hornetq-beans.xml
----------------------------------------------------------------------
diff --git a/examples/core/microcontainer/src/main/resources/hornetq-beans.xml 
b/examples/core/microcontainer/src/main/resources/hornetq-beans.xml
new file mode 100644
index 0000000..b68c7ae
--- /dev/null
+++ b/examples/core/microcontainer/src/main/resources/hornetq-beans.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+    <!-- MBean server -->
+   <bean name="MBeanServer" class="javax.management.MBeanServer">
+      <constructor factoryClass="java.lang.management.ManagementFactory"
+                   factoryMethod="getPlatformMBeanServer"/>
+   </bean>
+
+   <!-- The core configuration -->
+   <bean name="Configuration" 
class="org.hornetq.core.config.impl.FileConfiguration"/>
+
+   <!-- The security manager -->
+   <bean name="HornetQSecurityManager" 
class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
+      <start ignored="true"/>
+      <stop ignored="true"/>
+   </bean>
+
+   <!-- The core server -->
+   <bean name="HornetQServer" 
class="org.hornetq.core.server.impl.HornetQServerImpl">
+      <constructor>
+         <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+         <parameter>
+            <inject bean="MBeanServer"/>
+         </parameter>
+         <parameter>
+            <inject bean="HornetQSecurityManager"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+
+</deployment>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/microcontainer/src/main/resources/hornetq-configuration.xml
----------------------------------------------------------------------
diff --git 
a/examples/core/microcontainer/src/main/resources/hornetq-configuration.xml 
b/examples/core/microcontainer/src/main/resources/hornetq-configuration.xml
new file mode 100644
index 0000000..766b4b1
--- /dev/null
+++ b/examples/core/microcontainer/src/main/resources/hornetq-configuration.xml
@@ -0,0 +1,29 @@
+<configuration xmlns="urn:hornetq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+
+
+   <bindings-directory>target/data/messaging/bindings</bindings-directory>
+
+   <journal-directory>target/data/messaging/journal</journal-directory>
+
+   
<large-messages-directory>target/data/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>target/data/messaging/paging</paging-directory>
+
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
    
+         <param key="tcp-no-delay" value="false"/>
+         <param key="tcp-send-buffer-size" value="1048576"/>
+         <param key="tcp-receive-buffer-size" value="1048576"/>
+      </acceptor>
+   </acceptors>
+   
+   <security-enabled>false</security-enabled>
+   
+   <persistence-enabled>false</persistence-enabled>
+ 
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/perf/perf.properties
----------------------------------------------------------------------
diff --git a/examples/core/perf/perf.properties 
b/examples/core/perf/perf.properties
new file mode 100644
index 0000000..7e8b3d5
--- /dev/null
+++ b/examples/core/perf/perf.properties
@@ -0,0 +1,21 @@
+num-messages=100000
+num-warmup-messages=1000
+message-size=1024
+durable=false
+transacted=false
+batch-size=1048576
+drain-queue=false
+throttle-rate=-1
+address=perfAddress
+queue-name=perfQueue
+host=localhost
+port=5445
+tcp-buffer=2048576
+tcp-no-delay=false
+confirmation-window=1048576
+producer-window=1048576
+consumer-window=1048576
+pre-ack=false
+block-ack=false
+block-persistent=false
+use-send-acks=true

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/perf/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/perf/pom.xml b/examples/core/perf/pom.xml
new file mode 100644
index 0000000..759a9bc
--- /dev/null
+++ b/examples/core/perf/pom.xml
@@ -0,0 +1,180 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.hornetq.examples.core</groupId>
+      <artifactId>core-examples</artifactId>
+      <version>2.5.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>hornetq-core-perf-example</artifactId>
+   <packaging>jar</packaging>
+   <name>HornetQ Perf Example</name>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-core-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq</groupId>
+         <artifactId>hornetq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>io.netty</groupId>
+         <artifactId>netty-all</artifactId>
+         <version>${netty.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-jms-api</artifactId>
+         <version>1.1.0.GA</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.naming</groupId>
+         <artifactId>jnp-client</artifactId>
+         <version>5.0.5.Final</version>
+      </dependency>
+      <dependency>
+         <groupId>org.hornetq.examples.jms</groupId>
+         <artifactId>hornetq-jms-examples-common</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.jms</groupId>
+         <artifactId>jboss-jms-api_2.0_spec</artifactId>
+      </dependency>
+   </dependencies>
+
+   <profiles>
+      <profile>
+         <id>default</id>
+         <activation>
+            <activeByDefault>true</activeByDefault>
+         </activation>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.hornetq</groupId>
+                  <artifactId>hornetq-maven-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>start</id>
+                        <goals>
+                           <goal>start</goal>
+                        </goals>
+                        <configuration>
+                           <waitOnStart>true</waitOnStart>
+                           
<hornetqConfigurationDir>${basedir}/target/classes/server0</hornetqConfigurationDir>
+                           <systemProperties>
+                              <property>
+                                 <name>build.directory</name>
+                                 <value>${basedir}/target/</value>
+                              </property>
+                           </systemProperties>
+                        </configuration>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     <waitOnStart>false</waitOnStart>
+                     
<hornetqConfigurationDir>${basedir}/target/classes/server0</hornetqConfigurationDir>
+                  </configuration>
+                  <dependencies>
+                     <dependency>
+                        <groupId>org.hornetq.examples.core</groupId>
+                        <artifactId>hornetq-core-perf-example</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.hornetq</groupId>
+                        <artifactId>hornetq-core-client</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.hornetq</groupId>
+                        <artifactId>hornetq-server</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.hornetq</groupId>
+                        <artifactId>hornetq-jms-client</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.hornetq</groupId>
+                        <artifactId>hornetq-jms-server</artifactId>
+                        <version>${project.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>io.netty</groupId>
+                        <artifactId>netty-all</artifactId>
+                        <version>${netty.version}</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.jboss.javaee</groupId>
+                        <artifactId>jboss-jms-api</artifactId>
+                        <version>1.1.0.GA</version>
+                     </dependency>
+                     <dependency>
+                        <groupId>org.jboss.naming</groupId>
+                        <artifactId>jnpserver</artifactId>
+                        <version>5.0.3.GA</version>
+                     </dependency>
+                  </dependencies>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>listener</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     
<mainClass>org.hornetq.core.example.PerfListener</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>sender</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <version>1.1</version>
+                  <executions>
+                     <execution>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     <mainClass>org.hornetq.core.example.PerfSender</mainClass>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/perf/src/main/java/org/hornetq/core/example/PerfBase.java
----------------------------------------------------------------------
diff --git 
a/examples/core/perf/src/main/java/org/hornetq/core/example/PerfBase.java 
b/examples/core/perf/src/main/java/org/hornetq/core/example/PerfBase.java
new file mode 100644
index 0000000..d837a7e
--- /dev/null
+++ b/examples/core/perf/src/main/java/org/hornetq/core/example/PerfBase.java
@@ -0,0 +1,550 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Logger;
+
+import org.hornetq.api.core.Message;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.MessageHandler;
+import org.hornetq.api.core.client.SendAcknowledgementHandler;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.core.remoting.impl.netty.TransportConstants;
+import org.hornetq.utils.TokenBucketLimiter;
+import org.hornetq.utils.TokenBucketLimiterImpl;
+
+/**
+ *
+ * A PerfBase
+ *
+ * @author <a href="mailto:tim....@jboss.com";>Tim Fox</a>
+ *
+ *
+ */
+public abstract class PerfBase
+{
+   private static final Logger log = 
Logger.getLogger(PerfSender.class.getName());
+
+   private static final String DEFAULT_PERF_PROPERTIES_FILE_NAME = 
"perf.properties";
+
+   private static byte[] randomByteArray(final int length)
+   {
+      byte[] bytes = new byte[length];
+
+      Random random = new Random();
+
+      for (int i = 0; i < length; i++)
+      {
+         bytes[i] = Integer.valueOf(random.nextInt()).byteValue();
+      }
+
+      return bytes;
+   }
+
+   protected static String getPerfFileName(final String[] args)
+   {
+      String fileName;
+
+      if (args.length > 0)
+      {
+         fileName = args[0];
+      }
+      else
+      {
+         fileName = PerfBase.DEFAULT_PERF_PROPERTIES_FILE_NAME;
+      }
+
+      PerfBase.log.info("Using file name " + fileName);
+
+      return fileName;
+   }
+
+   protected static PerfParams getParams(final String fileName) throws 
Exception
+   {
+      Properties props = null;
+
+      InputStream is = null;
+
+      try
+      {
+         is = new FileInputStream(fileName);
+
+         props = new Properties();
+
+         props.load(is);
+      }
+      finally
+      {
+         if (is != null)
+         {
+            is.close();
+         }
+      }
+
+      int noOfMessages = Integer.valueOf(props.getProperty("num-messages"));
+      int noOfWarmupMessages = 
Integer.valueOf(props.getProperty("num-warmup-messages"));
+      int messageSize = Integer.valueOf(props.getProperty("message-size"));
+      boolean durable = Boolean.valueOf(props.getProperty("durable"));
+      boolean transacted = Boolean.valueOf(props.getProperty("transacted"));
+      int batchSize = Integer.valueOf(props.getProperty("batch-size"));
+      boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue"));
+      String queueName = props.getProperty("queue-name");
+      String address = props.getProperty("address");
+      int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
+      String host = props.getProperty("host");
+      int port = Integer.valueOf(props.getProperty("port"));
+      int tcpBufferSize = Integer.valueOf(props.getProperty("tcp-buffer"));
+      boolean tcpNoDelay = Boolean.valueOf(props.getProperty("tcp-no-delay"));
+      boolean preAck = Boolean.valueOf(props.getProperty("pre-ack"));
+      int confirmationWindowSize = 
Integer.valueOf(props.getProperty("confirmation-window"));
+      int producerWindowSize = 
Integer.valueOf(props.getProperty("producer-window"));
+      int consumerWindowSize = 
Integer.valueOf(props.getProperty("consumer-window"));
+      boolean blockOnACK = Boolean.valueOf(props.getProperty("block-ack", 
"false"));
+      boolean blockOnPersistent = 
Boolean.valueOf(props.getProperty("block-persistent", "false"));
+      boolean useSendAcks = Boolean.valueOf(props.getProperty("use-send-acks", 
"false"));
+
+      PerfBase.log.info("num-messages: " + noOfMessages);
+      PerfBase.log.info("num-warmup-messages: " + noOfWarmupMessages);
+      PerfBase.log.info("message-size: " + messageSize);
+      PerfBase.log.info("durable: " + durable);
+      PerfBase.log.info("transacted: " + transacted);
+      PerfBase.log.info("batch-size: " + batchSize);
+      PerfBase.log.info("drain-queue: " + drainQueue);
+      PerfBase.log.info("address: " + address);
+      PerfBase.log.info("queue name: " + queueName);
+      PerfBase.log.info("throttle-rate: " + throttleRate);
+      PerfBase.log.info("host:" + host);
+      PerfBase.log.info("port: " + port);
+      PerfBase.log.info("tcp buffer: " + tcpBufferSize);
+      PerfBase.log.info("tcp no delay: " + tcpNoDelay);
+      PerfBase.log.info("pre-ack: " + preAck);
+      PerfBase.log.info("confirmation-window: " + confirmationWindowSize);
+      PerfBase.log.info("producer-window: " + producerWindowSize);
+      PerfBase.log.info("consumer-window: " + consumerWindowSize);
+      PerfBase.log.info("block-ack:" + blockOnACK);
+      PerfBase.log.info("block-persistent:" + blockOnPersistent);
+      PerfBase.log.info("use-send-acks:" + useSendAcks);
+
+      if (useSendAcks && confirmationWindowSize < 1)
+      {
+         throw new IllegalArgumentException("If you use send acks, then need 
to set confirmation-window-size to a positive integer");
+      }
+
+      PerfParams perfParams = new PerfParams();
+      perfParams.setNoOfMessagesToSend(noOfMessages);
+      perfParams.setNoOfWarmupMessages(noOfWarmupMessages);
+      perfParams.setMessageSize(messageSize);
+      perfParams.setDurable(durable);
+      perfParams.setSessionTransacted(transacted);
+      perfParams.setBatchSize(batchSize);
+      perfParams.setDrainQueue(drainQueue);
+      perfParams.setQueueName(queueName);
+      perfParams.setAddress(address);
+      perfParams.setThrottleRate(throttleRate);
+      perfParams.setHost(host);
+      perfParams.setPort(port);
+      perfParams.setTcpBufferSize(tcpBufferSize);
+      perfParams.setTcpNoDelay(tcpNoDelay);
+      perfParams.setPreAck(preAck);
+      perfParams.setConfirmationWindow(confirmationWindowSize);
+      perfParams.setProducerWindow(producerWindowSize);
+      perfParams.setConsumerWindow(consumerWindowSize);
+      perfParams.setBlockOnACK(blockOnACK);
+      perfParams.setBlockOnPersistent(blockOnPersistent);
+      perfParams.setUseSendAcks(useSendAcks);
+
+      return perfParams;
+   }
+
+   private final PerfParams perfParams;
+
+   protected PerfBase(final PerfParams perfParams)
+   {
+      this.perfParams = perfParams;
+   }
+
+   private ClientSessionFactory factory;
+
+   private long start;
+
+   private void init(final boolean transacted, final String queueName) throws 
Exception
+   {
+      Map<String, Object> params = new HashMap<String, Object>();
+
+      params.put(TransportConstants.TCP_NODELAY_PROPNAME, 
perfParams.isTcpNoDelay());
+      params.put(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME, 
perfParams.getTcpBufferSize());
+      params.put(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME, 
perfParams.getTcpBufferSize());
+
+      params.put(TransportConstants.HOST_PROP_NAME, perfParams.getHost());
+      params.put(TransportConstants.PORT_PROP_NAME, perfParams.getPort());
+
+      ServerLocator serverLocator = 
HornetQClient.createServerLocatorWithoutHA(new 
TransportConfiguration(NettyConnectorFactory.class.getName(), params));
+      serverLocator.setPreAcknowledge(perfParams.isPreAck());
+      
serverLocator.setConfirmationWindowSize(perfParams.getConfirmationWindow());
+      serverLocator.setProducerWindowSize(perfParams.getProducerWindow());
+      serverLocator.setConsumerWindowSize(perfParams.getConsumerWindow());
+      serverLocator.setAckBatchSize(perfParams.getBatchSize());
+
+      serverLocator.setBlockOnAcknowledge(perfParams.isBlockOnACK());
+      serverLocator.setBlockOnDurableSend(perfParams.isBlockOnPersistent());
+      factory = serverLocator.createSessionFactory();
+
+   }
+
+   private void displayAverage(final long numberOfMessages, final long start, 
final long end)
+   {
+      double duration = (1.0 * end - start) / 1000; // in seconds
+      double average = 1.0 * numberOfMessages / duration;
+      PerfBase.log.info(String.format("average: %.2f msg/s (%d messages in 
%2.2fs)",
+                                      average,
+                                      numberOfMessages,
+                                      duration));
+   }
+
+   protected void runSender()
+   {
+      try
+      {
+         PerfBase.log.info("params = " + perfParams);
+
+         init(perfParams.isSessionTransacted(), perfParams.getQueueName());
+
+         if (perfParams.isDrainQueue())
+         {
+            drainQueue();
+         }
+
+         start = System.currentTimeMillis();
+         PerfBase.log.info("warming up by sending " + 
perfParams.getNoOfWarmupMessages() + " messages");
+         sendMessages(perfParams.getNoOfWarmupMessages(),
+                      perfParams.getBatchSize(),
+                      perfParams.isDurable(),
+                      perfParams.isSessionTransacted(),
+                      false,
+                      perfParams.getThrottleRate(),
+                      perfParams.getMessageSize(),
+                      perfParams.isUseSendAcks());
+         PerfBase.log.info("warmed up");
+         start = System.currentTimeMillis();
+         sendMessages(perfParams.getNoOfMessagesToSend(),
+                      perfParams.getBatchSize(),
+                      perfParams.isDurable(),
+                      perfParams.isSessionTransacted(),
+                      true,
+                      perfParams.getThrottleRate(),
+                      perfParams.getMessageSize(),
+                      perfParams.isUseSendAcks());
+         long end = System.currentTimeMillis();
+         displayAverage(perfParams.getNoOfMessagesToSend(), start, end);
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   protected void runListener()
+   {
+      ClientSession session = null;
+
+      try
+      {
+         init(perfParams.isSessionTransacted(), perfParams.getQueueName());
+
+         session = factory.createSession(!perfParams.isSessionTransacted(), 
!perfParams.isSessionTransacted());
+
+         if (perfParams.isDrainQueue())
+         {
+            drainQueue();
+         }
+
+         ClientConsumer consumer = 
session.createConsumer(perfParams.getQueueName());
+
+         session.start();
+
+         PerfBase.log.info("READY!!!");
+
+         CountDownLatch countDownLatch = new CountDownLatch(1);
+         consumer.setMessageHandler(new PerfListener(session, countDownLatch, 
perfParams));
+         countDownLatch.await();
+         long end = System.currentTimeMillis();
+         // start was set on the first received message
+         displayAverage(perfParams.getNoOfMessagesToSend(), start, end);
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+      finally
+      {
+         if (factory != null)
+         {
+            try
+            {
+               factory.close();
+            }
+            catch (Exception e)
+            {
+               e.printStackTrace();
+            }
+         }
+      }
+   }
+
+   private void drainQueue() throws Exception
+   {
+      PerfBase.log.info("Draining queue");
+
+      ClientSession session = null;
+
+      try
+      {
+         session = factory.createSession();
+
+         ClientConsumer consumer = 
session.createConsumer(perfParams.getQueueName());
+
+         session.start();
+
+         ClientMessage message = null;
+
+         int count = 0;
+         do
+         {
+            message = consumer.receive(3000);
+
+            if (message != null)
+            {
+               message.acknowledge();
+
+               count++;
+            }
+         }
+         while (message != null);
+
+         PerfBase.log.info("Drained " + count + " messages");
+      }
+      finally
+      {
+         if (session != null)
+         {
+            session.close();
+         }
+      }
+   }
+
+   private void sendMessages(final int numberOfMessages,
+                             final int txBatchSize,
+                             final boolean durable,
+                             final boolean transacted,
+                             final boolean display,
+                             final int throttleRate,
+                             final int messageSize,
+                             final boolean useSendAcks) throws Exception
+   {
+      ClientSession session = null;
+
+      try
+      {
+         session = factory.createSession(!transacted, !transacted);
+
+         CountDownLatch theLatch = null;
+
+         if (useSendAcks)
+         {
+            final CountDownLatch latch = new CountDownLatch(numberOfMessages);
+
+            class MySendAckHandler implements SendAcknowledgementHandler
+            {
+               public void sendAcknowledged(Message message)
+               {
+                  latch.countDown();
+               }
+            }
+
+            session.setSendAcknowledgementHandler(new MySendAckHandler());
+
+            theLatch = latch;
+         }
+
+         ClientProducer producer = 
session.createProducer(perfParams.getAddress());
+
+         ClientMessage message = session.createMessage(durable);
+
+         byte[] payload = PerfBase.randomByteArray(messageSize);
+
+         message.getBodyBuffer().writeBytes(payload);
+
+         final int modulo = 2000;
+
+         TokenBucketLimiter tbl = throttleRate != -1 ? new 
TokenBucketLimiterImpl(throttleRate, false) : null;
+
+         boolean committed = false;
+
+         for (int i = 1; i <= numberOfMessages; i++)
+         {
+            producer.send(message);
+
+            if (transacted)
+            {
+               if (i % txBatchSize == 0)
+               {
+                  session.commit();
+                  committed = true;
+               }
+               else
+               {
+                  committed = false;
+               }
+            }
+            if (display && i % modulo == 0)
+            {
+               double duration = (1.0 * System.currentTimeMillis() - start) / 
1000;
+               PerfBase.log.info(String.format("sent %6d messages in %2.2fs", 
i, duration));
+            }
+
+            // log.info("sent message " + i);
+
+            if (tbl != null)
+            {
+               tbl.limit();
+            }
+         }
+
+         if (transacted && !committed)
+         {
+            session.commit();
+         }
+
+         session.close();
+
+         if (useSendAcks)
+         {
+            theLatch.await();
+         }
+      }
+      finally
+      {
+         if (session != null)
+         {
+            session.close();
+         }
+      }
+   }
+
+   private class PerfListener implements MessageHandler
+   {
+      private final CountDownLatch countDownLatch;
+
+      private final PerfParams perfParams;
+
+      private boolean warmingUp = true;
+
+      private boolean started = false;
+
+      private final int modulo;
+
+      private final AtomicLong count = new AtomicLong(0);
+
+      private final ClientSession session;
+
+      public PerfListener(final ClientSession session, final CountDownLatch 
countDownLatch, final PerfParams perfParams)
+      {
+         this.session = session;
+         this.countDownLatch = countDownLatch;
+         this.perfParams = perfParams;
+         warmingUp = perfParams.getNoOfWarmupMessages() > 0;
+         modulo = 2000;
+      }
+
+      public void onMessage(final ClientMessage message)
+      {
+         try
+         {
+            if (warmingUp)
+            {
+               boolean committed = checkCommit(session);
+               if (count.incrementAndGet() == 
perfParams.getNoOfWarmupMessages())
+               {
+                  PerfBase.log.info("warmed up after receiving " + 
count.longValue() + " msgs");
+                  if (!committed)
+                  {
+                     checkCommit(session);
+                  }
+                  warmingUp = false;
+               }
+               return;
+            }
+
+            if (!started)
+            {
+               started = true;
+               // reset count to take stats
+               count.set(0);
+               start = System.currentTimeMillis();
+            }
+
+            message.acknowledge();
+
+            long currentCount = count.incrementAndGet();
+            boolean committed = checkCommit(session);
+            if (currentCount == perfParams.getNoOfMessagesToSend())
+            {
+               if (!committed)
+               {
+                  checkCommit(session);
+               }
+               countDownLatch.countDown();
+            }
+            if (currentCount % modulo == 0)
+            {
+               double duration = (1.0 * System.currentTimeMillis() - start) / 
1000;
+               PerfBase.log.info(String.format("received %6d messages in 
%2.2fs", currentCount, duration));
+            }
+         }
+         catch (Exception e)
+         {
+            e.printStackTrace();
+         }
+      }
+
+      private boolean checkCommit(final ClientSession session) throws Exception
+      {
+         if (perfParams.isSessionTransacted())
+         {
+            if (count.longValue() % perfParams.getBatchSize() == 0)
+            {
+               session.commit();
+
+               return true;
+            }
+         }
+         return false;
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/examples/core/perf/src/main/java/org/hornetq/core/example/PerfListener.java
----------------------------------------------------------------------
diff --git 
a/examples/core/perf/src/main/java/org/hornetq/core/example/PerfListener.java 
b/examples/core/perf/src/main/java/org/hornetq/core/example/PerfListener.java
new file mode 100644
index 0000000..355aa0c
--- /dev/null
+++ 
b/examples/core/perf/src/main/java/org/hornetq/core/example/PerfListener.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.example;
+
+import java.util.logging.Logger;
+
+/**
+ *
+ * A PerfListener
+ *
+ * @author <a href="mailto:tim....@jboss.com";>Tim Fox</a>
+ *
+ *
+ */
+public class PerfListener extends PerfBase
+{
+   private static final Logger log = 
Logger.getLogger(PerfListener.class.getName());
+
+   public static void main(final String[] args)
+   {
+      try
+      {
+         String fileName = PerfBase.getPerfFileName(args);
+
+         PerfParams params = PerfBase.getParams(fileName);
+
+         new PerfListener(params).run();
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   private PerfListener(final PerfParams perfParams)
+   {
+      super(perfParams);
+   }
+
+   public void run() throws Exception
+   {
+      runListener();
+   }
+
+}

Reply via email to