diff --git a/examples/jms/embedded-simple/readme.html b/examples/jms/embedded-simple/readme.html index 7a4104c20f..bf412588d6 100644 --- a/examples/jms/embedded-simple/readme.html +++ b/examples/jms/embedded-simple/readme.html @@ -34,38 +34,63 @@ under the License.
-- + +EmbeddedJMS jmsServer = new EmbeddedJMS(); - jmsServer.start();
+EmbeddedJMS jmsServer = new EmbeddedJMS();
+ SecurityConfiguration securityConfig = new SecurityConfiguration();
+ securityConfig.addUser("guest", "guest");
+ securityConfig.addRole("guest", "guest");
+ securityConfig.setDefaultUser("guest");
+ jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
+
+
+
+ jmsServer.start()
+
+
+
+ JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
+ List connectors = new ArrayList();
+ connectors.add("in-vm");
+ jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
+ jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");
+
+
At this point the JMS server is started and any JMS clients can look up JMS resources from the JNDI to send/receive messages from the server. To keep the example simple, we will send and receive a JMS message from the same JVM used to run the JMS server.
-ConnectionFactory cf = (ConnectionFactory)context.lookup("/cf"); - Queue queue = (Queue)context.lookup("/queue/queue1");
+ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("ConnectionFactory"); + Queue queue = (Queue)jmsServer.lookup("queue/exampleQueue");
See the Queue Example for detailed steps to send and receive a JMS message
+See the Queue Example for detailed steps to send and receive a JMS message
Finally, we stop the JMS server and its associated resources.
- + +
+ if (connection != null)
+ {
+ connection.close();
+ }
+
+
jmsServer.stop();
-
- naming.stop();
- jndiServer.stop();
-