[jboss-cvs] JBoss Messaging SVN: r6325 - in trunk: examples/jms and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 6 15:11:54 EDT 2009
Author: timfox
Date: 2009-04-06 15:11:53 -0400 (Mon, 06 Apr 2009)
New Revision: 6325
Added:
trunk/examples/jms/clustered-topic/
trunk/examples/jms/clustered-topic/build.xml
trunk/examples/jms/clustered-topic/config/
trunk/examples/jms/clustered-topic/config/client-jndi.properties
trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration0.xml
trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration1.xml
trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-0.xml
trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-1.xml
trunk/examples/jms/clustered-topic/config/jbm-jms.xml
trunk/examples/jms/clustered-topic/config/jbm-queues.xml
trunk/examples/jms/clustered-topic/config/jbm-security.xml
trunk/examples/jms/clustered-topic/readme.html
trunk/examples/jms/clustered-topic/src/
trunk/examples/jms/clustered-topic/src/org/
trunk/examples/jms/clustered-topic/src/org/jboss/
trunk/examples/jms/clustered-topic/src/org/jboss/jms/
trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/
trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java
Modified:
trunk/.classpath
Log:
added clustered topic example
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2009-04-06 18:13:09 UTC (rev 6324)
+++ trunk/.classpath 2009-04-06 19:11:53 UTC (rev 6325)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
+ <classpathentry kind="src" path="examples/jms/clustered-topic/src"/>
<classpathentry kind="src" path="examples/jms/durable-subscription/src"/>
<classpathentry kind="src" path="build/src"/>
<classpathentry kind="src" path="tests/config"/>
Added: trunk/examples/jms/clustered-topic/build.xml
===================================================================
--- trunk/examples/jms/clustered-topic/build.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/build.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,49 @@
+<?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 Clustered Topic Example">
+
+ <import file="../common/build.xml"/>
+
+ <target name="run">
+ <antcall target="runExample">
+ <param name="example.classname" value="org.jboss.jms.example.ClusteredTopicExample"/>
+ <param name="jbm.example.beans.file" value="jbm-example-clustered-topic-beans-0.xml jbm-example-clustered-topic-beans-1.xml"/>
+ </antcall>
+ </target>
+
+ <target name="runRemote">
+ <antcall target="runExample">
+ <param name="example.classname" value="org.jboss.jms.example.ClusteredTopicExample"/>
+ <param name="jbm.example.runServer" value="false"/>
+ </antcall>
+ </target>
+
+</project>
Added: trunk/examples/jms/clustered-topic/config/client-jndi.properties
===================================================================
--- trunk/examples/jms/clustered-topic/config/client-jndi.properties (rev 0)
+++ trunk/examples/jms/clustered-topic/config/client-jndi.properties 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:2099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration0.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration0.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration0.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,129 @@
+<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>true</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.management</management-address>
+ <management-notification-address>jbm.notifications</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>
+
+ <queue-activation-timeout>30000</queue-activation-timeout>
+
+ <backup>false</backup>
+
+ <persist-delivery-count-before-delivery>false</persist-delivery-count-before-delivery>
+
+ <!-- Connectors -->
+
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5445" type="Integer"/>
+ </connector>
+
+ <!-- Acceptors -->
+
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5445" type="Integer"/>
+ </acceptor>
+
+ <!-- Clustering configuration -->
+
+ <broadcast-group name="my-broadcast-group">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <broadcast-period>100</broadcast-period>
+ <connector-ref connector-name="netty-connector"/>
+ </broadcast-group>
+
+ <discovery-group name="my-discovery-group">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <refresh-timeout>10000</refresh-timeout>
+ </discovery-group>
+
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>true</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+
+ <!-- Paging configuration -->
+
+ <paging-max-threads>10</paging-max-threads>
+
+ <paging-directory>server0/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>server0/data/bindings</bindings-directory>
+
+ <create-bindings-dir>true</create-bindings-dir>
+
+ <journal-directory>server0/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>2</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>server0/data/largeMessages</large-messages-directory>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration1.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration1.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/clustered-topic-example-configuration1.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,130 @@
+<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>true</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.management</management-address>
+ <management-notification-address>jbm.notifications</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>
+
+ <queue-activation-timeout>30000</queue-activation-timeout>
+
+ <backup>false</backup>
+
+ <persist-delivery-count-before-delivery>false</persist-delivery-count-before-delivery>
+
+ <!-- Connectors -->
+
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5446" type="Integer"/>
+ </connector>
+
+ <!-- Acceptors -->
+
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5446" type="Integer"/>
+ </acceptor>
+
+ <!-- Clustering configuration -->
+
+ <broadcast-group name="my-broacast-group">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <broadcast-period>100</broadcast-period>
+ <connector-ref connector-name="netty-connector"/>
+ </broadcast-group>
+
+ <discovery-group name="my-discovery-group">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <refresh-timeout>10000</refresh-timeout>
+ </discovery-group>
+
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>true</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+
+
+ <!-- Paging configuration -->
+
+ <paging-max-threads>10</paging-max-threads>
+
+ <paging-directory>server1/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>server1/data/bindings</bindings-directory>
+
+ <create-bindings-dir>true</create-bindings-dir>
+
+ <journal-directory>server1/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>2</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>server1/data/largeMessages</large-messages-directory>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-0.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-0.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-0.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
+
+ <!-- JNDI server. Disable this if you don't want JNDI -->
+ <bean name="JNDIServer" class="org.jnp.server.Main">
+ <property name="namingInfo">
+ <inject bean="Naming"/>
+ </property>
+ <property name="port">1099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">1098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <bean name="DeploymentManager" class="org.jboss.messaging.core.deployers.impl.FileDeploymentManager">
+ <constructor>
+ <!-- The scan time in milliseconds -->
+ <parameter>5000</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration">
+ <property name="configurationUrl">clustered-topic-example-configuration0.xml</property>
+ </bean>
+
+ <!--<bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBossASSecurityManager"/>-->
+
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ </bean>
+
+ <bean name="BasicSecurityDeployer" class="org.jboss.messaging.core.deployers.impl.BasicSecurityDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ </constructor>
+ <property name="jbmSecurityManager">
+ <inject bean="JBMSecurityManager"/>
+ </property>
+ </bean>
+
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <depends>AddressSettingsDeployer</depends>
+ <depends>QueueDeployer</depends>
+
+ <property name="storageManager">
+ <inject bean="StorageManager"/>
+ </property>
+ <property name="remotingService">
+ <inject bean="RemotingService"/>
+ </property>
+ <property name="configuration">
+ <inject bean="Configuration"/>
+ </property>
+ <property name="securityManager">
+ <inject bean="JBMSecurityManager"/>
+ </property>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
+ </bean>
+
+ <bean name="StorageManager" class="org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="RemotingService" class="org.jboss.messaging.core.remoting.server.impl.RemotingServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
+ </bean>
+
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" property="serverManagement"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="postOffice"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="storageManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="addressSettingsRepository"/>
+ </parameter>
+ <parameter>
+ <inject bean="JMSManagementService"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JMSServerDeployer" class="org.jboss.messaging.jms.server.impl.JMSServerDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ <property name="jmsServerManager">
+ <inject bean="JMSServerManager"/>
+ </property>
+ </bean>
+
+ <bean name="AddressSettingsDeployer" class="org.jboss.messaging.core.deployers.impl.AddressSettingsDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="addressSettingsRepository" state="Configured"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="QueueDeployer" class="org.jboss.messaging.core.deployers.impl.QueueDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="SecurityDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="securityRepository"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="ManagementService" class="org.jboss.messaging.core.management.impl.ManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration" property="JMXManagementEnabled" />
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JMSManagementService" class="org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="ManagementService"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="java.lang.management.ManagementFactory"
+ factoryMethod="getPlatformMBeanServer"/>
+ </bean>
+
+</deployment>
Added: trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-1.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-1.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/jbm-example-clustered-topic-beans-1.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
+
+ <!-- JNDI server. Disable this if you don't want JNDI -->
+ <bean name="JNDIServer" class="org.jnp.server.Main">
+ <property name="namingInfo">
+ <inject bean="Naming"/>
+ </property>
+ <property name="port">2099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">2098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <bean name="DeploymentManager" class="org.jboss.messaging.core.deployers.impl.FileDeploymentManager">
+ <constructor>
+ <!-- The scan time in milliseconds -->
+ <parameter>5000</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration">
+ <property name="configurationUrl">clustered-topic-example-configuration1.xml</property>
+ </bean>
+
+ <!--<bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBossASSecurityManager"/>-->
+
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ </bean>
+
+ <bean name="BasicSecurityDeployer" class="org.jboss.messaging.core.deployers.impl.BasicSecurityDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ </constructor>
+ <property name="jbmSecurityManager">
+ <inject bean="JBMSecurityManager"/>
+ </property>
+ </bean>
+
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <depends>AddressSettingsDeployer</depends>
+ <depends>QueueDeployer</depends>
+
+ <property name="storageManager">
+ <inject bean="StorageManager"/>
+ </property>
+ <property name="remotingService">
+ <inject bean="RemotingService"/>
+ </property>
+ <property name="configuration">
+ <inject bean="Configuration"/>
+ </property>
+ <property name="securityManager">
+ <inject bean="JBMSecurityManager"/>
+ </property>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
+ </bean>
+
+ <bean name="StorageManager" class="org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="RemotingService" class="org.jboss.messaging.core.remoting.server.impl.RemotingServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
+ </bean>
+
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" property="serverManagement"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="postOffice"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="storageManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="addressSettingsRepository"/>
+ </parameter>
+ <parameter>
+ <inject bean="JMSManagementService"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JMSServerDeployer" class="org.jboss.messaging.jms.server.impl.JMSServerDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ <property name="jmsServerManager">
+ <inject bean="JMSServerManager"/>
+ </property>
+ </bean>
+
+ <bean name="AddressSettingsDeployer" class="org.jboss.messaging.core.deployers.impl.AddressSettingsDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="addressSettingsRepository" state="Configured"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="QueueDeployer" class="org.jboss.messaging.core.deployers.impl.QueueDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="SecurityDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="DeploymentManager"/>
+ </parameter>
+ <parameter>
+ <inject bean="MessagingServer" property="securityRepository"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="ManagementService" class="org.jboss.messaging.core.management.impl.ManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="Configuration" property="JMXManagementEnabled" />
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JMSManagementService" class="org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="ManagementService"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="java.lang.management.ManagementFactory"
+ factoryMethod="getPlatformMBeanServer"/>
+ </bean>
+
+</deployment>
Added: trunk/examples/jms/clustered-topic/config/jbm-jms.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/jbm-jms.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,18 @@
+<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-connector"/>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </connection-factory>
+
+ <!--the topic used by the example-->
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/clustered-topic/config/jbm-queues.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/jbm-queues.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -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="jms.topic.exampleTopic">
+ <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/clustered-topic/config/jbm-security.xml
===================================================================
--- trunk/examples/jms/clustered-topic/config/jbm-security.xml (rev 0)
+++ trunk/examples/jms/clustered-topic/config/jbm-security.xml 2009-04-06 19:11:53 UTC (rev 6325)
@@ -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/clustered-topic/readme.html
===================================================================
--- trunk/examples/jms/clustered-topic/readme.html (rev 0)
+++ trunk/examples/jms/clustered-topic/readme.html 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,92 @@
+<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>We look-up the JMS connection factory object from JNDI</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>We create a JMS text message that we are going to send.</li>
+ <pre>
+ <code>TextMessage message = session.createTextMessage("This is a text message");</code>
+ </pre>
+
+ <li>We send message to the queue</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>TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);</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/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java
===================================================================
--- trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java (rev 0)
+++ trunk/examples/jms/clustered-topic/src/org/jboss/jms/example/ClusteredTopicExample.java 2009-04-06 19:11:53 UTC (rev 6325)
@@ -0,0 +1,132 @@
+/*
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.integration.transports.netty.TransportConstants;
+import org.jboss.messaging.jms.JBossTopic;
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
+
+/**
+ * A simple JMS Topic example
+ *
+ */
+public class ClusteredTopicExample extends JMSExample
+{
+ public static void main(String[] args)
+ {
+ new ClusteredTopicExample().run(args);
+ }
+
+ public boolean runExample() throws Exception
+ {
+ Connection connection0 = null;
+
+ Connection connection1 = null;
+ try
+ {
+ Topic topic = new JBossTopic("exampleTopic");
+
+ Map<String, Object> params0 = new HashMap<String, Object>();
+ params0.put(TransportConstants.PORT_PROP_NAME, 5445);
+ TransportConfiguration tc0 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
+ params0);
+ ConnectionFactory cf0 = new JBossConnectionFactory(tc0);
+
+ Map<String, Object> params1 = new HashMap<String, Object>();
+ params1.put(TransportConstants.PORT_PROP_NAME, 5446);
+ TransportConfiguration tc1 = new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory",
+ params1);
+ ConnectionFactory cf1 = new JBossConnectionFactory(tc1);
+
+ connection0 = cf0.createConnection();
+
+ connection1 = cf1.createConnection();
+
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ connection0.start();
+
+ connection1.start();
+
+ MessageConsumer consumer0 = session0.createConsumer(topic);
+
+ MessageConsumer consumer1 = session1.createConsumer(topic);
+
+ Thread.sleep(1000);
+
+ MessageProducer producer = session0.createProducer(topic);
+
+ final int numMessages = 10;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message = session0.createTextMessage("This is text message " + i);
+
+ producer.send(message);
+
+ System.out.println("Sent message: " + message.getText());
+ }
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message0 = (TextMessage)consumer0.receive(5000);
+
+ System.out.println("Got message: " + message0.getText() + " from node 0");
+
+ TextMessage message1 = (TextMessage)consumer1.receive(5000);
+
+ System.out.println("Got message: " + message1.getText() + " from node 1");
+ }
+
+ return true;
+ }
+ finally
+ {
+ // Step 12. Be sure to close our JMS resources!
+ if (connection0 != null)
+ {
+ connection0.close();
+ }
+
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+
+ }
+ }
+
+}
More information about the jboss-cvs-commits
mailing list