[jboss-cvs] JBoss Messaging SVN: r6817 - in trunk/examples/javaee/jca-config: src/org/jboss/javaee/example/server and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat May 16 03:55:30 EDT 2009


Author: ataylor
Date: 2009-05-16 03:55:30 -0400 (Sat, 16 May 2009)
New Revision: 6817

Modified:
   trunk/examples/javaee/jca-config/readme.html
   trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server/MDBQueueA.java
   trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/MDBQueueB.java
   trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/StatelessSender.java
Log:
fixed jca-config example readme

Modified: trunk/examples/javaee/jca-config/readme.html
===================================================================
--- trunk/examples/javaee/jca-config/readme.html	2009-05-16 07:38:42 UTC (rev 6816)
+++ trunk/examples/javaee/jca-config/readme.html	2009-05-16 07:55:30 UTC (rev 6817)
@@ -50,6 +50,8 @@
 ...
 </code></pre>
 
+     <p>In this example however we will configure the default adapter.</p>
+
      <p>Other application servers will provide different ways of binding the resource-adapter.</p>
      
      <h2>Connection Factory Properties</h2>
@@ -132,22 +134,17 @@
      <p>You may choose to deploy multiple JBossMessaging Resource adapters on the same application server, for example if you are connecting to different JBM servers and if you wish to have a higher control of properties on each server you are connecting to. You will be able to determine which rar you are using individually at each <i>MDB</i> and <i>ConnectionFactory</i> as specified before here. Just copy the directory jms-ra.rar in your application as any other name with the extension .rar and use that file name at your deployments.</p>
 
      <p>Please refer to JBoss Messaging Quickstart guide to <a href="../../../docs/quickstartguide/en/html_single/index.html#installation.jboss">install it in JBoss AS 5<a></p>
+
      
-     <h2>Please follow these steps to configure the example:</h2>
-     <ol>
-     <li>Copy the directory <code>$JBOSS_HOME/server/default-with-jbm2</code> to <code>$JBOSS_HOME/server/default-with-jbm2_2</code>.</li>
-     <li>Start the first server with <code>./run.sh -c default-with-jbm2</code></li>
-     <li>Start the second server with <code>./run.sh -c default-with-jbm2_2 -Djboss.service.binding.set=ports-01</code></li>
-     </ol>
-     
      <h2>Example step-by-step</h2>
-     <p><i>To deploy the example, simply type <code>ant deploy</code> from this directory **</i></p>
-     <p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
-     <p><i>To undeploy the example, simply type <code>ant undeploy</code> from this directory **</i></p>
+     <p><i>To deploy and start the first server, simply type <code>ant deploy</code> from the example directory</i></p>
+     <p><i>After the first server has started start the second server, simply type <code>ant deploy2</code> from the example directory</i></p>
+     <p><i>To run the example, simply type <code>ant run</code> from the example directory</i></p>
+     <p><i>To undeploy the example, simply type <code>ant undeploy undeploy2</code> from the example directory</i></p>
      <p><i> ** make sure that JBOSS_HOME is set to the JBoss installation directory</i></p>
      <br>
      <ol>
-        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>jndi.properties</code> file in the directory <code>config</code></li>
+        <li>First we need to get an initial context so we can look-up the EJB on the second server from JNDI. This initial context will get it's properties from the <code>jndi.properties</code> file in the directory <code>config</code></li>
         <pre>
            <code>initialContext = new InitialContext();</code>
         </pre>
@@ -161,23 +158,11 @@
          <pre><code>
          sender.sendHello("Hello there MDB!");
          </code></pre>
-         
-         
-         <li>Sending a message to Queue B, that will be received by MDBQueueB</li> 
-         <pre><code>
-         ConnectionFactory cf = new JBossConnectionFactory(transportConfiguration);
-         Queue queue = new JBossQueue("B");
-         Connection conn = cf.createConnection("guest", "guest");
-         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer prod = sess.createProducer(queue);
-         prod.send(sess.createTextMessage("Hello there MDB talking to another RAR!"));
-         conn.close();
-         </code></pre>
 
-
-         <li>On StatelessSender.java: Define the destination that will receive the message (instead of using JNDI to the remote server)</li>
+         <li>On the second server we invoke the EJB StatelessSender: This will send 2 messages to server 1 using the configured outbound adapter</li>
          <pre><code>
-         JBossQueue destQueue = new JBossQueue("testQueue");
+         JBossQueue destQueueA = new JBossQueue("A");
+         JBossQueue destQueueB = new JBossQueue("B");
          </code></pre>
       
          <li>Create a connection to a remote server using a connection-factory (look at the deployed file jms-remote-ds.xml). JCA will actually manage this thorugh a <i>Connection Pool</i></li>
@@ -185,19 +170,25 @@
          Connection conn = connectionFactory.createConnection("guest", "guest");
          </code></pre>
       
-         <li>Send a message to a QueueA on the remote server, which will be received by MDBQueueA</li>
+         <li>Send a message to a QueueA on server1, which will be received by MDBQueueA on server1</li>
          <pre><code>
          Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer prod = sess.createProducer(destQueue);
+         MessageProducer prodA = sess.createProducer(destQueueA);
          prod.send(sess.createTextMessage(message));
          </code></pre>
 
+         <li>Send a message to a QueueB on the remote server1, which will be received by MDBQueueA on server2</li>
+         <pre><code>
+         MessageProducer prodB = sess.createProducer(destQueueB);
+         prodB.send(sess.createTextMessage(message));
+         </code></pre>
+
          <li>Close the connection. (Since this is a JCA connection, this close will save the connection to a connection pool)</li>
          <pre><code>
          conn.close();
          </code></pre>
          
-         <li>The message is received on the MDBQueueA, using the Remote Queue</li>
+         <li>The message is received on the MDBQueueA on server1 which consumed from a local queue</li>
 
          <pre><code>
 @MessageDriven(name = "MDB_QueueA",
@@ -205,17 +196,15 @@
                      {
                         @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                         @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/A"),
-                        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
-                        @ActivationConfigProperty(propertyName = "ConnectorClassName", propertyValue = "org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"),
-                        @ActivationConfigProperty(propertyName = "ConnectionParameters", propertyValue = "jbm.remoting.netty.port=5545") // Port on the second server
+                        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"))
                      })
 public class MDBQueueA implements MessageListener
 {
-   public void onMessage(Message message)
+   public void onMessage(Message message).....
          </code></pre>         
           
 
-         <li>Another message is received on MDBQueueB, using the Remote Queue. This MDB is using a different ResourceAdapter. Notice you didn't need to specify any Connection properties here, as you have different default values when using this resource-adapter (example-jbm-ra.rar).</li>
+         <li>Another message is received on MDBQueueB on server2 which consumed from a remote queue on server1.
 
          <pre><code>
 @MessageDriven(name = "MDB_QueueB",
@@ -229,7 +218,7 @@
 
 public class MDBQueueB implements MessageListener
 {
-
+   public void onMessage(Message message).....
          </code></pre>         
           
 

Modified: trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server/MDBQueueA.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server/MDBQueueA.java	2009-05-16 07:38:42 UTC (rev 6816)
+++ trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server/MDBQueueA.java	2009-05-16 07:55:30 UTC (rev 6817)
@@ -32,7 +32,7 @@
  * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
  */
 
-//Step 9. The message is received on the MDB, using a remote queue.
+//Step 9. The message is received on the MDB, using a local queue.
 @MessageDriven(name = "MDB_QueueA",
                activationConfig =
                      {

Modified: trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/MDBQueueB.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/MDBQueueB.java	2009-05-16 07:38:42 UTC (rev 6816)
+++ trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/MDBQueueB.java	2009-05-16 07:55:30 UTC (rev 6817)
@@ -32,8 +32,8 @@
  * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
  */
 
-//Step 9. The message is received on the MDB, using a remote queue.
- at MessageDriven(name = "MDB_QueueA",
+//Step 10. The message is received on the MDB, using a remote queue.
+ at MessageDriven(name = "MDB_QueueB",
                activationConfig =
                      {
                         @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

Modified: trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/StatelessSender.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/StatelessSender.java	2009-05-16 07:38:42 UTC (rev 6816)
+++ trunk/examples/javaee/jca-config/src/org/jboss/javaee/example/server2/StatelessSender.java	2009-05-16 07:55:30 UTC (rev 6817)
@@ -57,27 +57,27 @@
     */
    public void sendHello(String message) throws Exception
    {
-      // Step 5. Define the destination that will receive the message (instead of using JNDI to the remote server)
+      // Step 4. Define the destinations that will receive the message (instead of using JNDI to the remote server)
       JBossQueue destQueueA = new JBossQueue("A");
-
       JBossQueue destQueueB = new JBossQueue("B");
       
-      // Step 6. Create a connection to a remote server using a connection-factory (look at the deployed file jms-remote-ds.xml)
+      // Step 5. Create a connection to a remote server using a connection-factory (look at the deployed file jms-remote-ds.xml)
       Connection conn = connectionFactory.createConnection("guest", "guest");
       
-      // Step 7. Send a message to a QueueA on the remote server, which will be received by MDBQueueA
+      // Step 6. Send a message to a QueueA on the remote server, which will be received by MDBQueueA
       Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
       MessageProducer prodA = sess.createProducer(destQueueA);
       prodA.send(sess.createTextMessage(message));
 
       System.out.println("Step 7 (StatelessSender.java): Sent message \"" + message + "\" to QueueA");
 
+      // Step 6. Send a message to a QueueB on the remote server, which will be received by MDBQueueA
       MessageProducer prodB = sess.createProducer(destQueueB);
       prodB.send(sess.createTextMessage(message));
       
       System.out.println("Step 8 (StatelessSender.java): Sent message \"" + message + "\" to QueueB");
 
-      // Step 8. Close the connection. (Since this is a JCA connection, this will just place the connection back to a connection pool)
+      // Step 7. Close the connection. (Since this is a JCA connection, this will just place the connection back to a connection pool)
       conn.close();
       System.out.println("Step 9 (StatelessSender.java): Closed Connection (sending it back to pool)");
       




More information about the jboss-cvs-commits mailing list