[jboss-cvs] JBoss Messaging SVN: r6312 - in trunk: examples/jms and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 3 20:30:06 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-04-03 20:30:06 -0400 (Fri, 03 Apr 2009)
New Revision: 6312

Added:
   trunk/examples/jms/large-message/
   trunk/examples/jms/large-message/build.xml
   trunk/examples/jms/large-message/config/
   trunk/examples/jms/large-message/config/jbm-configuration.xml
   trunk/examples/jms/large-message/config/jbm-jms.xml
   trunk/examples/jms/large-message/config/jbm-queues.xml
   trunk/examples/jms/large-message/config/jbm-security.xml
   trunk/examples/jms/large-message/readme.html
   trunk/examples/jms/large-message/src/
   trunk/examples/jms/large-message/src/org/
   trunk/examples/jms/large-message/src/org/jboss/
   trunk/examples/jms/large-message/src/org/jboss/jms/
   trunk/examples/jms/large-message/src/org/jboss/jms/example/
   trunk/examples/jms/large-message/src/org/jboss/jms/example/LargeMessageExample.java
Modified:
   trunk/.classpath
   trunk/src/config/jbm-jms.xml
   trunk/src/schemas/jbm-jms.xsd
Log:
LargeMessage example & configs

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2009-04-03 22:36:12 UTC (rev 6311)
+++ trunk/.classpath	2009-04-04 00:30:06 UTC (rev 6312)
@@ -19,6 +19,7 @@
 	<classpathentry kind="src" path="examples/jms/dead-letter/src"/>
 	<classpathentry kind="src" path="examples/jms/durable/src"/>
 	<classpathentry kind="src" path="examples/jms/expiry/src"/>
+	<classpathentry kind="src" path="examples/jms/large-message/src"/>
 	<classpathentry kind="src" path="examples/jms/paging/src"/>
 	<classpathentry kind="src" path="examples/jms/queue/src"/>
 	<classpathentry kind="src" path="examples/jms/queue-requestor/src"/>


Property changes on: trunk/examples/jms/large-message
___________________________________________________________________
Name: svn:ignore
   + build


Added: trunk/examples/jms/large-message/build.xml
===================================================================
--- trunk/examples/jms/large-message/build.xml	                        (rev 0)
+++ trunk/examples/jms/large-message/build.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- JBoss, Home of Professional Open Source                                                     -->
+<!-- Copyright 2005, JBoss Inc., and individual contributors as indicated                        -->
+<!-- by the @authors tag. See the copyright.txt in the distribution for a                        -->
+<!-- full listing of individual contributors.                                                    -->
+<!--                                                                                             -->
+<!-- This is free software; you can redistribute it and/or modify it                             -->
+<!-- under the terms of the GNU Lesser General Public License as                                 -->
+<!-- published by the Free Software Foundation; either version 2.1 of                            -->
+<!-- the License, or (at your option) any later version.                                         -->
+<!--                                                                                             -->
+<!-- This software is distributed in the hope that it will be useful,                            -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of                              -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                            -->
+<!-- Lesser General Public License for more details.                                             -->
+<!--                                                                                             -->
+<!-- You should have received a copy of the GNU Lesser General Public                            -->
+<!-- License along with this software; if not, write to the Free                                 -->
+<!-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA                          -->
+<!-- 02110-1301 USA, or see the FSF site: http://www.fsf.org.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging JMS Queue Example">
+
+   <import file="../common/build.xml"/>
+
+   <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.LargeMessageExample"/>
+      </antcall>
+   </target>
+
+   <target name="runRemote">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.LargeMessageExample"/>
+         <param name="jbm.example.runServer" value="false"/>
+      </antcall>
+   </target>
+
+</project>

Added: trunk/examples/jms/large-message/config/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/large-message/config/jbm-configuration.xml	                        (rev 0)
+++ trunk/examples/jms/large-message/config/jbm-configuration.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,194 @@
+<deployment xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-configuration.xsd">
+   <configuration>
+
+      <clustered>false</clustered>
+
+      <!-- Maximum number of threads to use for scheduled deliveries -->
+      <scheduled-max-pool-size>30</scheduled-max-pool-size>
+
+      <security-enabled>true</security-enabled>
+
+      <security-invalidation-interval>10000</security-invalidation-interval>
+
+      <wild-card-routing-enabled>true</wild-card-routing-enabled>
+
+      <management-address>jbm.admin.management</management-address>
+      <management-notification-address>jbm.admin.notification</management-notification-address>
+
+      <!-- true to expose JBoss Messaging resources through JMX -->
+      <jmx-management-enabled>true</jmx-management-enabled>
+
+      <!-- by default, message counter is disabled -->
+      <message-counter-enabled>false</message-counter-enabled>
+
+      <connection-scan-period>10000</connection-scan-period>
+
+      <!--how long before timing a transaction out-->
+      <transaction-timeout>60000</transaction-timeout>
+      <!--how often to scan for timedout transactions-->
+      <transaction-timeout-scan-period>1000</transaction-timeout-scan-period>
+
+      <!-- how often do we scan the queues for expired messages-->
+      <message-expiry-scan-period>30000</message-expiry-scan-period>
+      <!-- the priority of the thread that expires th emessages (between 1 - 10 inclusive)-->
+      <message-expiry-thread-priority>3</message-expiry-thread-priority>
+
+      <!-- Example interceptors
+      <remoting-interceptors>
+         <class-name>org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor1</class-name>
+         <class-name>org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor2</class-name>
+      </remoting-interceptors>
+      -->
+
+      <queue-activation-timeout>30000</queue-activation-timeout>
+
+      <backup>false</backup>
+
+      <persist-delivery-count-before-delivery>false</persist-delivery-count-before-delivery>
+
+      <allow-route-when-no-bindings>false</allow-route-when-no-bindings>
+
+      <!--
+      <backup-connector-ref connector-name="netty-backup"/>
+      -->
+
+      <!-- Connectors -->
+
+      <connector name="netty-backup">
+      	<factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6400" type="Integer"/>
+      </connector>
+
+      <connector name="netty">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+      </connector>
+
+      <connector name="netty-ssl">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>
+         <param key="jbm.remoting.netty.sslenabled" value="true" type="Boolean"/>
+      </connector>
+
+      <connector name="netty-http">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6100" type="Integer"/>
+         <param key="jbm.remoting.netty.httpenabled" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.httpclientidletime" value="500" type="Long"/>
+         <param key="jbm.remoting.netty.httpclientidlescanperiod" value="500" type="Long"/>
+      </connector>
+
+      <connector name="netty-servlet">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="8080" type="Integer"/>
+         <param key="jbm.remoting.netty.useservlet" value="true" type="Boolean"/>
+      </connector>
+
+      <connector name="in-vm">
+         <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+      </connector>
+
+      <!-- Acceptors -->
+
+      <!-- In VM acceptor -->
+      <acceptor name="in-vm">
+         <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+         <param key="jbm.remoting.invm.serverid" value="0" type="Integer"/>
+      </acceptor>
+      <!-- Netty standard TCP acceptor -->
+      <acceptor name="netty">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+      </acceptor>
+      <!-- Netty SSL Acceptor
+      <acceptor name="netty-ssl">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>
+         <param key="jbm.remoting.netty.sslenabled" value="true" type="Boolean"/>
+      </acceptor>
+      -->
+        <!--Netty HTTP Acceptor-->
+      <!--<acceptor name-"netty-http">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6100" type="Integer"/>
+         <param key="jbm.remoting.netty.httpenabled" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.httpresponsetime" value="10000" type="Long"/>
+         <param key="jbm.remoting.netty.httpserverscanperiod" value="5000" type="Long"/>
+      </acceptor>-->
+     <!-- netty invm acceptor, needed for the servlet transport-->
+     <!-- <acceptor name="netty-invm">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.useinvm" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.host" value="org.jboss.jbm" type="String"/>
+      </acceptor>-->
+
+      <!-- Clustering configuration -->
+
+      <broadcast-group name="bg-group1">
+        <local-bind-port>1234</local-bind-port>
+        <group-address>231.7.7.7</group-address>
+        <group-port>9876</group-port>
+        <broadcast-period>5000</broadcast-period>
+        <connector-ref connector-name="netty" backup-connector-name="netty-backup"/>
+      </broadcast-group>
+
+      <discovery-group name="dg-group1">
+        <group-address>231.7.7.7</group-address>
+        <group-port>9876</group-port>
+        <refresh-timeout>10000</refresh-timeout>
+      </discovery-group>
+
+      <!--  Paging configuration -->
+
+      <paging-max-threads>10</paging-max-threads>
+
+      <paging-directory>build/data/paging</paging-directory>
+
+      <paging-global-watermark-size>10485760</paging-global-watermark-size>
+
+      <paging-max-global-size-bytes>104857600</paging-max-global-size-bytes>
+
+      <!-- Storage configuration -->
+
+      <bindings-directory>build/data/bindings</bindings-directory>
+
+      <create-bindings-dir>true</create-bindings-dir>
+
+      <journal-directory>build/data/journal</journal-directory>
+
+      <create-journal-dir>true</create-journal-dir>
+
+      <journal-type>NIO</journal-type>
+
+      <!-- The journal will reuse any buffers where the size < journal-buffer-reuse-size on write operations
+           Set this to -1 to disable this feature -->
+      <journal-buffer-reuse-size>1536</journal-buffer-reuse-size>
+
+      <!-- Does the journal sync to disk on each transaction commit, prepare or rollback? -->
+      <journal-sync-transactional>true</journal-sync-transactional>
+
+      <!-- Does the journal sync to disk for every non transactional persistent operation? -->
+      <journal-sync-non-transactional>false</journal-sync-non-transactional>
+
+      <!-- 10 MB journal file size -->
+      <journal-file-size>10485760</journal-file-size>
+
+      <journal-min-files>15</journal-min-files>
+
+      <!-- Maximum simultaneous asynchronous writes accepted by the native layer.
+      (parameter ignored on NIO)
+       You can verify the max AIO on the OS level at /proc/sys/fs/aio_max_nr. (aio-nr will give you the current max-aio being used)
+      -->
+      <journal-max-aio>10000</journal-max-aio>
+
+      <large-messages-directory>build/data/largeMessages</large-messages-directory>
+      
+   </configuration>
+
+</deployment>

Added: trunk/examples/jms/large-message/config/jbm-jms.xml
===================================================================
--- trunk/examples/jms/large-message/config/jbm-jms.xml	                        (rev 0)
+++ trunk/examples/jms/large-message/config/jbm-jms.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,22 @@
+<deployment xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+   <!--the connection factory used by the example-->
+   <connection-factory name="ConnectionFactory">
+      <connector-ref connector-name="netty"/>
+      <entry name="ConnectionFactory"/>
+      <entry name="XAConnectionFactory"/>
+      <entry name="java:/ConnectionFactory"/>
+      <entry name="java:/XAConnectionFactory"/>
+      
+      <!-- When using this ConnectionFactory, messages beyond this limit are considered largeMessages and will be sent using smaller packets -->
+      <big-message-size>10240</big-message-size>
+      
+   </connection-factory>
+
+   <!--the queue used by the example-->
+   <queue name="exampleQueue">
+      <entry name="/queue/exampleQueue"/>
+   </queue>
+
+</deployment>
\ No newline at end of file

Added: trunk/examples/jms/large-message/config/jbm-queues.xml
===================================================================
--- trunk/examples/jms/large-message/config/jbm-queues.xml	                        (rev 0)
+++ trunk/examples/jms/large-message/config/jbm-queues.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,15 @@
+<settings xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-queues.xsd ">
+
+   <!--security for example queue-->
+   <security match="queuejms.exampleQueue">
+      <permission type="createDurableQueue" roles="guest"/>
+      <permission type="deleteDurableQueue" roles="guest"/>
+      <permission type="createTempQueue" roles="guest"/>
+      <permission type="deleteTempQueue" roles="guest"/>
+      <permission type="consume" roles="guest"/>
+      <permission type="send" roles="guest"/>
+   </security>
+
+</settings>

Added: trunk/examples/jms/large-message/config/jbm-security.xml
===================================================================
--- trunk/examples/jms/large-message/config/jbm-security.xml	                        (rev 0)
+++ trunk/examples/jms/large-message/config/jbm-security.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-security.xsd ">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</deployment>
\ No newline at end of file

Added: trunk/examples/jms/large-message/readme.html
===================================================================
--- trunk/examples/jms/large-message/readme.html	                        (rev 0)
+++ trunk/examples/jms/large-message/readme.html	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,94 @@
+<html>
+  <head>
+    <title>JBoss Messaging JMS Queue Example</title>
+    <link rel="stylesheet" type="text/css" href="../common/common.css">
+  </head>
+  <body>
+     <h1>JMS Queue Example</h1>
+     <br>
+     <p>This example shows you how to send and receive a message to a JMS Queue with JBoss Messaging.</p>
+     <p>Queues are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p>
+     <p>A Queue is used to send messages point to point, from a producer to a consumer. The queue guarantees message ordering between these 2 points.</p>
+     <br>
+     <h2>Example step-by-step</h2>
+     <p><i>To run the example, simply type <code>ant</code> from this 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>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
+        <pre>
+           <code>InitialContext initialContext = getContext();</code>
+        </pre>
+
+        <li>We look-up the JMS queue object from JNDI</li>
+        <pre>
+           <code>Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");</code>
+        </pre>
+
+        <li>Perform a lookup on the Connection Factory. This ConnectionFactory has a special set on this example (jbm-jms.xml). Messages with more than 10K are considered large.</li>
+        <pre>
+           <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
+        </pre>
+
+        <li>We create a JMS connection</li>
+        <pre>
+           <code>connection = cf.createConnection();</code>
+        </pre>
+
+        <li>We create a JMS session. The session is created as non transacted and will auto acknowledge messages.</li>
+        <pre>
+           <code>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
+        </pre>
+
+        <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
+        <pre>
+          <code>MessageProducer messageProducer = session.createProducer(topic);</code>
+       </pre>
+
+        <li>Create a BytesMessage with 1MB arbitrary bytes</li>
+        <pre><code>
+         BytesMessage message = session.createBytesMessage();
+         message.writeBytes(new byte[1024 * 1024]);
+        </code></pre>
+
+        <li>We send message to the queue. After the send completion the message file will be located at ./build/data/largeMessages</li>
+        <pre>
+           <code>messageProducer.send(message);</code>
+        </pre>
+
+        <li>We create a JMS Message Consumer to receive the message.</li>
+          <pre>
+           <code>MessageConsumer messageConsumer = session.createConsumer(queue);</code>
+        </pre>
+
+        <li>We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started</li>
+        <pre>
+           <code>connection.start();</code>
+        </pre>
+
+        <li>The message arrives at the consumer. In this case we use a timeout of 5000 milliseconds but we could use a blocking 'receive()'</li>
+        <pre><code>
+        BytesMessage messageReceived = (BytesMessage) messageConsumer.receive(5000);
+        System.out.println("Received message: " + messageReceived.getBodyLength() + " bytes");
+        </code></pre>
+
+        <li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
+
+        <pre>
+           <code>finally
+           {
+              if (initialContext != null)
+              {
+                initialContext.close();
+              }
+              if (connection != null)
+              {
+                 connection.close();
+              }
+           }</code>
+        </pre>
+
+
+
+     </ol>
+  </body>
+</html>
\ No newline at end of file

Added: trunk/examples/jms/large-message/src/org/jboss/jms/example/LargeMessageExample.java
===================================================================
--- trunk/examples/jms/large-message/src/org/jboss/jms/example/LargeMessageExample.java	                        (rev 0)
+++ trunk/examples/jms/large-message/src/org/jboss/jms/example/LargeMessageExample.java	2009-04-04 00:30:06 UTC (rev 6312)
@@ -0,0 +1,109 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.jms.example;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+
+/**
+ * A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class LargeMessageExample extends JMSExample
+{
+   public static void main(String[] args)
+   {
+      new LargeMessageExample().run(args);
+   }
+
+   public boolean runExample() throws Exception
+   {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try
+      {
+         //Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = getContext();
+
+         //Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("/queue/exampleQueue");
+
+         //Step 3. Perform a lookup on the Connection Factory. This ConnectionFactory has a special set on this example. Messages with more than 10K are considered large
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+
+         //Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         //Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         //Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         //Step 7. Create a BytesMessage with 1MB arbitrary bytes
+         BytesMessage message = session.createBytesMessage();
+         message.writeBytes(new byte[1024 * 1024]);
+         
+         //Step 8. Send the Message
+         producer.send(message);
+         
+         System.out.println("Large Message sent");
+         
+         // if you sleep the example and look at ./build/data/largeMessages you will see the largeMessage stored on disk
+
+         //Step 9. Create a JMS Message Consumer
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         //Step 10. Start the Connection
+         connection.start();
+
+         //Step 11. Receive the message
+         BytesMessage messageReceived = (BytesMessage) messageConsumer.receive(5000);
+
+         System.out.println("Received message: " + messageReceived.getBodyLength() + " bytes");
+
+         initialContext.close();
+         
+         return true;
+      }
+      finally
+      {
+         //Step 12. Be sure to close our JMS resources!
+         if (initialContext != null)
+         {
+            initialContext.close();
+         }
+         if(connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+
+}

Modified: trunk/src/config/jbm-jms.xml
===================================================================
--- trunk/src/config/jbm-jms.xml	2009-04-03 22:36:12 UTC (rev 6311)
+++ trunk/src/config/jbm-jms.xml	2009-04-04 00:30:06 UTC (rev 6312)
@@ -60,6 +60,8 @@
       <producer-window-size>1048576</producer-window-size>
       <!-- This is the maximum producer send rate that will be applied when using rate based producer flow control -->
       <producer-max-rate>100</producer-max-rate>
+      <!-- When using this ConnectionFactory, messages beyond this limit are considered largeMessages and will be sent using smaller packets -->
+      <big-message-size>10240</big-message-size>
       <!-- This is the window size in bytes to use when using consumer window based flow control -->
       <consumer-window-size>1048576</consumer-window-size>
       <!-- This is the maximum producer send rate that will be applied when using rate based consumer flow control -->

Modified: trunk/src/schemas/jbm-jms.xsd
===================================================================
--- trunk/src/schemas/jbm-jms.xsd	2009-04-03 22:36:12 UTC (rev 6311)
+++ trunk/src/schemas/jbm-jms.xsd	2009-04-04 00:30:06 UTC (rev 6312)
@@ -56,6 +56,9 @@
             <xsd:element name="producer-max-rate" type="xsd:int"
                 maxOccurs="1" minOccurs="0">
             </xsd:element>
+            <xsd:element name="big-message-size" type="xsd:positiveInteger"
+                maxOccurs="1" minOccurs="0">
+            </xsd:element>
             <xsd:element name="consumer-window-size" type="xsd:positiveInteger"
                 maxOccurs="1" minOccurs="0">
             </xsd:element>




More information about the jboss-cvs-commits mailing list