[jboss-cvs] JBoss Messaging SVN: r6542 - in trunk: examples/javaee/hajndi and 44 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 23 13:16:29 EDT 2009
Author: timfox
Date: 2009-04-23 13:16:28 -0400 (Thu, 23 Apr 2009)
New Revision: 6542
Added:
trunk/examples/jms/symmetric-cluster/
trunk/examples/jms/symmetric-cluster/build.xml
trunk/examples/jms/symmetric-cluster/readme.html
trunk/examples/jms/symmetric-cluster/server0/
trunk/examples/jms/symmetric-cluster/server0/KILL_ME
trunk/examples/jms/symmetric-cluster/server0/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server0/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server0/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server0/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server0/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server0/jbm-users.xml
trunk/examples/jms/symmetric-cluster/server1/
trunk/examples/jms/symmetric-cluster/server1/KILL_ME
trunk/examples/jms/symmetric-cluster/server1/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server1/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server1/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server1/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server1/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server1/jbm-users.xml
trunk/examples/jms/symmetric-cluster/server2/
trunk/examples/jms/symmetric-cluster/server2/KILL_ME
trunk/examples/jms/symmetric-cluster/server2/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server2/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server2/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server2/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server2/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server2/jbm-users.xml
trunk/examples/jms/symmetric-cluster/server3/
trunk/examples/jms/symmetric-cluster/server3/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server3/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server3/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server3/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server3/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server3/jbm-users.xml
trunk/examples/jms/symmetric-cluster/server4/
trunk/examples/jms/symmetric-cluster/server4/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server4/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server4/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server4/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server4/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server4/jbm-users.xml
trunk/examples/jms/symmetric-cluster/server5/
trunk/examples/jms/symmetric-cluster/server5/client-jndi.properties
trunk/examples/jms/symmetric-cluster/server5/jbm-configuration.xml
trunk/examples/jms/symmetric-cluster/server5/jbm-jms.xml
trunk/examples/jms/symmetric-cluster/server5/jbm-queues.xml
trunk/examples/jms/symmetric-cluster/server5/jbm-standalone-beans.xml
trunk/examples/jms/symmetric-cluster/server5/jbm-users.xml
trunk/examples/jms/symmetric-cluster/src/
trunk/examples/jms/symmetric-cluster/src/org/
trunk/examples/jms/symmetric-cluster/src/org/jboss/
trunk/examples/jms/symmetric-cluster/src/org/jboss/jms/
trunk/examples/jms/symmetric-cluster/src/org/jboss/jms/example/
trunk/examples/jms/symmetric-cluster/src/org/jboss/jms/example/SymmetricClusterExample.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueDeployerTest.java
Removed:
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java
Modified:
trunk/.classpath
trunk/examples/javaee/hajndi/readme.html
trunk/examples/jms/automatic-failover/build.xml
trunk/examples/jms/queue/server0/jbm-standalone-beans.xml
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java
trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java
trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/JMSManagementService.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/connection/ExceptionListenerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSQueueControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControl2Test.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/TopicControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java
trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
Log:
fixed deployment order etc
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/.classpath 2009-04-23 17:16:28 UTC (rev 6542)
@@ -14,6 +14,7 @@
<classpathentry kind="src" path="src/schemas"/>
<classpathentry kind="src" path="tests/joram-tests/src"/>
<classpathentry kind="src" path="tests/joram-tests/config"/>
+ <classpathentry kind="src" path="examples/jms/symmetric-cluster/src"/>
<classpathentry kind="src" path="examples/jms/application-layer-failover/src"/>
<classpathentry kind="src" path="examples/jms/automatic-failover/src"/>
<classpathentry kind="src" path="examples/jms/bridge/src"/>
Modified: trunk/examples/javaee/hajndi/readme.html
===================================================================
--- trunk/examples/javaee/hajndi/readme.html 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/examples/javaee/hajndi/readme.html 2009-04-23 17:16:28 UTC (rev 6542)
@@ -30,7 +30,7 @@
<li>Define the property JBOSS_HOME pointing to the root of a JBoss 5.1 distribution</li>
<li>Create a JBoss messaging clustered profile by typing <code>ant</code> int the <code>AS</code> directory off the root of
the JBoss Messaging distribution. This will create a server profile called <code>$JBOSS_HOME/server/jbm2_symmetric</code>.</li>
- <li>Copy the directory <code>$JBOSS_HOME/server/jbm2_symmetric</code> to <code>$JBOSS_HOME/server/jbm2_symmetric_2</code></li>
+ <li>Copy the directory <code>$JBOSS_HOME/server/jbm2_symmetric</code> to <code>$JBOSS_HOME/server/jbm2_symmetric_2</code>.</li>
<li>Start the first server with <code>./run.sh -c jbm2_symmetric</code></li>
<li>Start the second server with <code>./run.sh -c jbm2_symmetric_2 -Djboss.service.binding.set=ports-01</li>
</ol>
Modified: trunk/examples/jms/automatic-failover/build.xml
===================================================================
--- trunk/examples/jms/automatic-failover/build.xml 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/examples/jms/automatic-failover/build.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -45,8 +45,7 @@
<param name="jbm.example.runServer" value="false"/>
</antcall>
</target>
-
- <!-- Need to delete the server data dirs before each run since after failover cannot just rerun test since backup is now live -->
+
<target name="delete-files" depends="clean">
<delete file="./server1/KILL_ME"/>
</target>
Modified: trunk/examples/jms/queue/server0/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/queue/server0/jbm-standalone-beans.xml 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/examples/jms/queue/server0/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -32,6 +32,8 @@
<!-- The core server -->
<bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
<constructor>
<parameter>
<inject bean="Configuration"/>
Added: trunk/examples/jms/symmetric-cluster/build.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/build.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/build.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,58 @@
+<?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 Symmetric Cluster Example">
+
+ <import file="../common/build.xml"/>
+
+ <target name="run" depends="delete-files">
+ <antcall target="runExample">
+ <param name="example.classname" value="org.jboss.jms.example.SymmetricClusterExample"/>
+ <param name="jbm.example.beans.file" value="server3 server4 server5 server0 server1 server2"/>
+
+ <param name="java-min-memory" value="50M"/>
+ <param name="java-max-memory" value="100M"/>
+ </antcall>
+ </target>
+
+ <target name="runRemote" depends="delete-files">
+ <antcall target="runExample">
+ <param name="example.classname" value="org.jboss.jms.example.SymmetricClusterExample"/>
+ <param name="jbm.example.runServer" value="false"/>
+ </antcall>
+ </target>
+
+ <target name="delete-files" depends="clean">
+ <delete file="./server0/KILL_ME"/>
+ <delete file="./server1/KILL_ME"/>
+ <delete file="./server2/KILL_ME"/>
+ </target>
+
+</project>
Added: trunk/examples/jms/symmetric-cluster/readme.html
===================================================================
--- trunk/examples/jms/symmetric-cluster/readme.html (rev 0)
+++ trunk/examples/jms/symmetric-cluster/readme.html 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,175 @@
+<html>
+ <head>
+ <title>JBoss Messaging JMS Symmetric Cluster Example</title>
+ <link rel="stylesheet" type="text/css" href="../common/common.css">
+ </head>
+ <body>
+ <h1>JBoss Messaging JMS Symmetric Cluster Example</h1>
+ <br>
+ <p>This example demonstrates a JMS queue deployed on two different nodes. The two nodes are configured to form a cluster.</p>
+ <p>We then create a consumer on the queue on each node, and we create a producer on only one of the nodes.</p>
+ <p>We then send some messages via the producer, and we verify that <b>both</b> consumers receive the sent messages
+ in a round-robin fashion.</p>
+ <p>In other words, JBoss Messaging <b>load balances</b> the sent messages across all consumers on the cluster</p>
+ <p>This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use
+ JNDI, these could be instantiated directly.</p>
+ <p>Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes
+ and to load balance the messages between the nodes.</p>
+ <pre>
+ <code>
+ <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>
+ </code>
+ </pre>
+ <p>For more information on JBoss Messaging load balancing, and clustering in general, please see the clustering
+ section of the user manual.</p>
+ <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> Get an initial context for looking up JNDI from server 0.</li>
+ <pre>
+ <code>
+ ic0 = getContext(0);
+ </code>
+ </pre>
+
+ <li>Look-up the JMS Queue object from JNDI</li>
+ <pre>
+ <code>Queue queue = (Queue)ic0.lookup("/queue/exampleQueue");</code>
+ </pre>
+
+ <li>Look-up a JMS Connection Factory object from JNDI on server 0</li>
+ <pre>
+ <code>ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");</code>
+ </pre>
+
+ <li>Get an initial context for looking up JNDI from server 1.</li>
+ <pre>
+ <code>ic1 = getContext(1);</code>
+ </pre>
+
+ <li>Look-up a JMS Connection Factory object from JNDI on server 1</li>
+ <pre>
+ <code>ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
+ </code>
+ </pre>
+
+ <li>We create a JMS Connection connection0 which is a connection to server 0</li>
+ <pre>
+ <code>
+ connection0 = cf0.createConnection();
+ </code>
+ </pre>
+
+ <li>We create a JMS Connection connection1 which is a connection to server 1</li>
+ <pre>
+ <code>
+ connection1 = cf1.createConnection();
+ </code>
+ </pre>
+
+ <li>We create a JMS Session on server 0</li>
+ <pre>
+ <code>
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ </code>
+ </pre>
+
+ <li>We create a JMS Session on server 1</li>
+ <pre>
+ <code>
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ </code>
+ </pre>
+
+ <li>We start the connections to ensure delivery occurs on them</li>
+ <pre>
+ <code>
+ connection0.start();
+
+ connection1.start();
+ </code>
+ </pre>
+
+ <li>We create JMS MessageConsumer objects on server 0 and server 1</li>
+ <pre>
+ <code>
+ MessageConsumer consumer0 = session0.createConsumer(queue);
+
+ MessageConsumer consumer1 = session1.createConsumer(queue);
+ </code>
+ </pre>
+
+ <li>We create a JMS MessageProducer object on server 0.</li>
+ <pre>
+ <code>
+ MessageProducer producer = session0.createProducer(queue);</code>
+ </pre>
+
+ <li>We send some messages to server 0.</li>
+ <pre>
+ <code>
+ 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());
+ }
+ </code>
+ </pre>
+
+ <li>We now consume those messages on *both* server 0 and server 1.
+ We note the messages have been distributed between servers in a round robin fashion.
+ JBoss Messaging has <b>load balanced</b> the messages between the available consumers on the different nodes.
+ JBoss Messaging can be configured to always load balance messages to all nodes, or to only balance messages
+ to nodes which have consumers with no or matching selectors. See the user manual for more details.</li>
+ JMS Queues implement point-to-point message where each message is only ever consumed by a
+ maximum of one consumer.
+ <pre>
+ <code>
+ for (int i = 0; i < numMessages; i += 2)
+ {
+ 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");
+ }
+ </code>
+ </pre>
+
+ <li>And finally (no pun intended), <b>always</b> remember to close your JMS 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 (connection0 != null)
+ {
+ connection0.close();
+ }
+
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+ }
+ </code>
+ </pre>
+
+ </ol>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server0/KILL_ME
===================================================================
Added: trunk/examples/jms/symmetric-cluster/server0/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/symmetric-cluster/server0/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,67 @@
+<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>
+
+ <backup-connector-ref connector-name="backup-connector"/>
+
+ <!-- Connectors -->
+
+ <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>
+
+ <connector name="backup-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5448" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <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>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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" backup-connector-name="backup-connector"/>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server0/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server0/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server0/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,60 @@
+<?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>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server0/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server0/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server0/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/server1/KILL_ME
===================================================================
Added: trunk/examples/jms/symmetric-cluster/server1/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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/symmetric-cluster/server1/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,67 @@
+<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>
+
+ <backup-connector-ref connector-name="backup-connector"/>
+
+ <!-- Connectors -->
+
+ <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>
+
+ <connector name="backup-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5449" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <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>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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" backup-connector-name="backup-connector"/>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server1/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server1/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server1/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,59 @@
+<?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>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server1/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server1/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server1/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/server2/KILL_ME
===================================================================
Added: trunk/examples/jms/symmetric-cluster/server2/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:3099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/symmetric-cluster/server2/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,67 @@
+<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>
+
+ <backup-connector-ref connector-name="backup-connector"/>
+
+ <!-- Connectors -->
+
+ <connectors>
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5447" type="Integer"/>
+ </connector>
+
+ <connector name="backup-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5450" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5447" type="Integer"/>
+ </acceptor>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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" backup-connector-name="backup-connector"/>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server2/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server2/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server2/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,59 @@
+<?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">3099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">3098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server2/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server2/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server2/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/server3/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:4099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/symmetric-cluster/server3/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,62 @@
+<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>
+
+ <backup>true</backup>
+
+ <!-- Connectors -->
+
+ <connectors>
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5448" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5448" type="Integer"/>
+ </acceptor>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server3/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server3/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server3/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,60 @@
+<?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">4099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">4098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server3/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server3/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server3/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/server4/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:5099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/symmetric-cluster/server4/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,61 @@
+<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>
+
+ <backup>true</backup>
+
+ <!-- Connectors -->
+ <connectors>
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5449" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5449" type="Integer"/>
+ </acceptor>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server4/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server4/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server4/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,59 @@
+<?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">5099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">5098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server4/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server4/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server4/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/server5/client-jndi.properties
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/client-jndi.properties (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/client-jndi.properties 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:6099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/examples/jms/symmetric-cluster/server5/jbm-configuration.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/jbm-configuration.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/jbm-configuration.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,61 @@
+<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>
+
+ <backup>true</backup>
+
+ <!-- Connectors -->
+ <connectors>
+ <connector name="netty-connector">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5450" type="Integer"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="jbm.remoting.netty.port" value="5450" type="Integer"/>
+ </acceptor>
+ </acceptors>
+
+ <!-- Clustering configuration -->
+ <broadcast-groups>
+ <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>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <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>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <retry-interval>500</retry-interval>
+ <use-duplicate-detection>true</use-duplicate-detection>
+ <forward-when-no-consumers>false</forward-when-no-consumers>
+ <max-hops>1</max-hops>
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <!-- Other config -->
+
+ <journal-min-files>2</journal-min-files>
+
+ </configuration>
+
+</deployment>
Added: trunk/examples/jms/symmetric-cluster/server5/jbm-jms.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/jbm-jms.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/jbm-jms.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,25 @@
+<deployment xmlns="urn:jboss:messaging"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+ <!--This connection factory is not actually used in the example, but we keep it here for good
+ measure -->
+ <connection-factory name="ConnectionFactory">
+ <discovery-group-ref discovery-group-name="my-discovery-group"/>
+ <entries>
+ <entry name="ConnectionFactory"/>
+ <entry name="XAConnectionFactory"/>
+ <entry name="java:/ConnectionFactory"/>
+ <entry name="java:/XAConnectionFactory"/>
+ </entries>
+ </connection-factory>
+
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+ <topic name="exampleTopic">
+ <entry name="/topic/exampleTopic"/>
+ </topic>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server5/jbm-queues.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/jbm-queues.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/jbm-queues.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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 ">
+
+ <!-- Default JMS security -->
+ <security match="jms.#">
+ <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/symmetric-cluster/server5/jbm-standalone-beans.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/jbm-standalone-beans.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/jbm-standalone-beans.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,59 @@
+<?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">6099</property>
+ <property name="bindAddress">localhost</property>
+ <property name="rmiPort">6098</property>
+ <property name="rmiBindAddress">localhost</property>
+ </bean>
+
+ <!-- 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.jboss.messaging.core.config.impl.FileConfiguration"/>
+
+ <!-- The security manager -->
+ <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The core server -->
+ <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ <parameter>
+ <inject bean="JBMSecurityManager"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MessagingServer" state="CREATE"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: trunk/examples/jms/symmetric-cluster/server5/jbm-users.xml
===================================================================
--- trunk/examples/jms/symmetric-cluster/server5/jbm-users.xml (rev 0)
+++ trunk/examples/jms/symmetric-cluster/server5/jbm-users.xml 2009-04-23 17:16:28 UTC (rev 6542)
@@ -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-users.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/symmetric-cluster/src/org/jboss/jms/example/SymmetricClusterExample.java
===================================================================
--- trunk/examples/jms/symmetric-cluster/src/org/jboss/jms/example/SymmetricClusterExample.java (rev 0)
+++ trunk/examples/jms/symmetric-cluster/src/org/jboss/jms/example/SymmetricClusterExample.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,272 @@
+/*
+ * 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.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.JBossTopic;
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
+
+/**
+ * This example demonstrates a cluster of three nodes set up in a symmetric topology - i.e. each node
+ * is connected to every other node in the cluster. Also each node, has it's own backup node.
+ *
+ * This is probably the most obvious clustering topology and the one most people will be familiar with from
+ * using clustering in an app server, where every node has pretty much identical configuration to every other node.
+ *
+ * By clustering nodes symmetrically, JBoss Messaging can give the impression of clustered queues, topics and
+ * durable subscriptions.
+ *
+ * In this example we send some messages to a distributed queue and topic and kill all the live servers at different
+ * times, and verify that they transparently fail over onto their backup servers.
+ *
+ * Please see the readme.html file for more information.
+ *
+ * @author <a href="tim.fox at jboss.com>Tim Fox</a>
+ */
+public class SymmetricClusterExample extends JMSExample
+{
+ public static void main(String[] args)
+ {
+ String[] serverArgs = new String[] { "-Xms50M",
+ "-Xmx100M",
+ "-XX:+UseParallelGC",
+ "-XX:+AggressiveOpts",
+ "-XX:+UseFastAccessorMethods" };
+
+ new SymmetricClusterExample().run(serverArgs, args);
+ }
+
+ public boolean runExample() throws Exception
+ {
+ Connection connection0 = null;
+
+ Connection connection1 = null;
+
+ Connection connection2 = null;
+
+ try
+ {
+ // Step 1 - We instantiate a connection factory directly, specifying the UDP address and port for discovering
+ // the list of servers in the cluster.
+ // We could use JNDI to look-up a connection factory, but we'd need to know the JNDI server host and port for the
+ // specific server to do that, and that server might not be available at the time. By creating the
+ // connection factory directly we avoid having to worry about a JNDI look-up.
+ // In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without
+ // having to know about a specific one.
+ ConnectionFactory cf = new JBossConnectionFactory("231.7.7.7", 9876);
+
+ // We give a little while for each server to broadcast its whereabouts to the client
+ Thread.sleep(2000);
+
+ // Step 2. Directly instantiate JMS Queue and Topic objects
+ Queue queue = new JBossQueue("exampleQueue");
+
+ Topic topic = new JBossTopic("exampleTopic");
+
+ // Step 3. We create three connections, they should be to different nodes of the cluster in a round-robin fashion
+ // and start them
+ connection0 = cf.createConnection();
+
+ connection1 = cf.createConnection();
+
+ connection2 = cf.createConnection();
+
+ connection0.start();
+
+ connection1.start();
+
+ connection2.start();
+
+ // Step 4. We create a session on each connection
+
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // Step 5. We create a topic subscriber on each server
+
+ MessageConsumer subscriber0 = session0.createConsumer(topic);
+
+ MessageConsumer subscriber1 = session1.createConsumer(topic);
+
+ MessageConsumer subscriber2 = session2.createConsumer(topic);
+
+ // Step 6. We create a queue consumer on server 0
+
+ MessageConsumer consumer0 = session0.createConsumer(queue);
+
+ // Give a little time for consumers to propagate throughout cluster
+ Thread.sleep(2000);
+
+ // Step 7. We create an anonymous message producer on just one server 2
+
+ MessageProducer producer2 = session2.createProducer(null);
+
+ final int numMessages = 500;
+
+ // Step 8. We send 500 messages each to the queue and topic
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message1 = session2.createTextMessage("Topic message 1");
+
+ producer2.send(topic, message1);
+
+ TextMessage message2 = session2.createTextMessage("Queue message 1");
+
+ producer2.send(queue, message2);
+ }
+
+ // Step 9. We kill live server 1, this will cause connection1 to transparently fail over onto server 4
+
+ killServer(1);
+
+ // Step 9. Verify all subscribers receive the messages
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage received0 = (TextMessage)subscriber0.receive(5000);
+
+ if (received0 == null)
+ {
+ return false;
+ }
+
+ TextMessage received1 = (TextMessage)subscriber1.receive(5000);
+
+ if (received1 == null)
+ {
+ return false;
+ }
+
+ TextMessage received2 = (TextMessage)subscriber2.receive(5000);
+
+ if (received2 == null)
+ {
+ return false;
+ }
+
+ TextMessage received3 = (TextMessage)consumer0.receive(5000);
+
+ if (received3 == null)
+ {
+ return false;
+ }
+ }
+
+ // Step 10. Send 500 more messages to the queue and topic
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ // Step 11. Half way through sending we kill server 2
+
+ if (i == numMessages / 2)
+ {
+ killServer(2);
+ }
+
+ TextMessage message3 = session2.createTextMessage("Topic message 2");
+
+ producer2.send(topic, message3);
+
+ TextMessage message4 = session2.createTextMessage("Queue message 2");
+
+ producer2.send(queue, message4);
+ }
+
+
+ //Step 11. Verify all the messages are received by the subscribers
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ // Step 12. Half way through receiving, we kill server 0
+
+ if (i == numMessages / 2)
+ {
+ killServer(0);
+ }
+
+ TextMessage received0 = (TextMessage)subscriber0.receive(5000);
+
+ if (received0 == null)
+ {
+ return false;
+ }
+
+ TextMessage received1 = (TextMessage)subscriber1.receive(5000);
+
+ if (received1 == null)
+ {
+ return false;
+ }
+
+ TextMessage received2 = (TextMessage)subscriber2.receive(5000);
+
+ if (received2 == null)
+ {
+ return false;
+ }
+
+ TextMessage received3 = (TextMessage)consumer0.receive(5000);
+
+ if (received3 == null)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ finally
+ {
+ // Step 15. Be sure to close our resources!
+
+ if (connection0 != null)
+ {
+ connection0.close();
+ }
+
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+
+ if (connection2 != null)
+ {
+ connection2.close();
+ }
+
+ }
+ }
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -855,7 +855,7 @@
if (!ok)
{
throw new MessagingException(MessagingException.CONNECTION_TIMEDOUT,
- "Timed out waiting to receive intial broadcast from discovery group");
+ "Timed out waiting to receive initial broadcast from discovery group");
}
}
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ConnectionManagerImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -574,7 +574,7 @@
backupTransportParams = null;
- done = reattachSessions(reconnectAttempts == -1 ? -1 : reconnectAttempts + 1);
+ done = reattachSessions(reconnectAttempts == -1 ? -1 : reconnectAttempts + 1);
}
else if (reconnectAttempts != 0)
{
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -73,9 +73,6 @@
started = true;
- // We run once first synchronously to make sure any already registered deployers get deployed
- run();
-
scheduler = Executors.newSingleThreadScheduledExecutor();
future = scheduler.scheduleWithFixedDelay(this, period, period, TimeUnit.MILLISECONDS);
@@ -119,43 +116,38 @@
{
deployers.add(deployer);
- if (started)
+ String[] filenames = deployer.getConfigFileNames();
+
+ for (String filename : filenames)
{
- String[] filenames = deployer.getConfigFileNames();
+ log.debug("the filename is " + filename);
- for (String filename : filenames)
- {
- log.debug("the filename is " + filename);
+ log.debug(System.getProperty("java.class.path"));
- log.debug(System.getProperty("java.class.path"));
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
- Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
- while (urls.hasMoreElements())
- {
- URL url = urls.nextElement();
+ log.debug("Got url " + url);
- log.debug("Got url " + url);
-
- try
- {
- log.debug("Deploying " + deployer + " with url " + url);
- deployer.deploy(url);
- }
- catch (Exception e)
- {
- log.error("Error deploying " + url, e);
- }
-
- Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
-
- deployed.put(pair, new DeployInfo(deployer, new File(url.getFile()).lastModified()));
+ try
+ {
+ log.debug("Deploying " + deployer + " with url " + url);
+ deployer.deploy(url);
}
+ catch (Exception e)
+ {
+ log.error("Error deploying " + url, e);
+ }
+
+ Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
+
+ deployed.put(pair, new DeployInfo(deployer, new File(url.getFile()).lastModified()));
}
- }
+ }
}
-
- log.debug("Done register");
}
public synchronized void unregisterDeployer(final Deployer deployer) throws Exception
@@ -197,11 +189,9 @@
for (String filename : filenames)
{
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(filename);
-
- boolean hasUrl = false;
+
while (urls.hasMoreElements())
{
- hasUrl = true;
URL url = urls.nextElement();
Pair<URL, Deployer> pair = new Pair<URL, Deployer>(url, deployer);
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueDeployer.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -22,28 +22,28 @@
package org.jboss.messaging.core.deployers.impl;
-import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.cluster.QueueConfiguration;
import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import java.util.List;
-
/**
* A QueueDeployer
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
*/
public class QueueDeployer extends XmlDeployer
{
- private final Configuration serverConfiguration;
+ private final MessagingServerControlMBean serverControl;
- public QueueDeployer(final DeploymentManager deploymentManager, final Configuration configuration)
+ public QueueDeployer(final DeploymentManager deploymentManager, final MessagingServerControlMBean serverControl)
{
super(deploymentManager);
- this.serverConfiguration = configuration;
+
+ this.serverControl = serverControl;
}
/**
@@ -76,14 +76,17 @@
public void deploy(Node node) throws Exception
{
QueueConfiguration queueConfig = parseQueueConfiguration(node);
- List<QueueConfiguration> configurations = serverConfiguration.getQueueConfigurations();
- configurations.add(queueConfig);
- serverConfiguration.setQueueConfigurations(configurations);
+
+ serverControl.deployQueue(queueConfig.getAddress(),
+ queueConfig.getName(),
+ queueConfig.getFilterString(),
+ queueConfig.isDurable());
}
@Override
public void undeploy(Node node) throws Exception
{
+ // Undeploy means nothing for core queues
}
/**
@@ -102,7 +105,7 @@
String address = null;
String filterString = null;
boolean durable = false;
-
+
NodeList children = node.getChildNodes();
for (int j = 0; j < children.getLength(); j++)
Modified: trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -30,6 +30,7 @@
import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.utils.SimpleString;
/**
* This interface describes the core management interface exposed by the server
@@ -112,6 +113,18 @@
String filter, @Parameter(name = "durable", desc = "Is the queue durable?")
boolean durable) throws Exception;
+ @Operation(desc = "Deploy a queue", impact = ACTION)
+ void deployQueue(@Parameter(name = "address", desc = "Address of the queue")
+ String address, @Parameter(name = "name", desc = "Name of the queue")
+ String name) throws Exception;
+
+ @Operation(desc = "Deploy a queue", impact = ACTION)
+ void deployQueue(@Parameter(name = "address", desc = "Address of the queue")
+ String address, @Parameter(name = "name", desc = "Name of the queue")
+ String name, @Parameter(name = "filter", desc = "Filter of the queue")
+ String filter, @Parameter(name = "durable", desc = "Is the queue durable?")
+ boolean durable) throws Exception;
+
@Operation(desc = "Destroy a queue", impact = ACTION)
void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy")
String name) throws Exception;
@@ -154,7 +167,7 @@
String connectionID) throws Exception;
TabularData getConnectors() throws Exception;
-
+
void sendQueueInfoToQueue(String queueName, String address) throws Exception;
boolean isPersistDeliveryCountBeforeDelivery();
@@ -162,32 +175,31 @@
long getQueueActivationTimeout();
long getConnectionTTLOverride();
-
+
String getManagementAddress();
-
+
String getManagementNotificationAddress();
-
+
long getManagementRequestTimeout();
-
+
int getIDCacheSize();
-
+
boolean isPersistIDCache();
-
+
int getPagingMaxThreads();
-
+
int getPagingGlobalWatermarkSize();
-
+
String getLargeMessagesDirectory();
-
+
boolean isWildcardRoutingEnabled();
-
+
long getTransactionTimeout();
-
+
long getTransactionTimeoutScanPeriod();
long getMessageExpiryScanPeriod();
long getMessageExpiryThreadPriority();
-
}
Modified: trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -30,7 +30,6 @@
*/
public interface ReplicationOperationInvoker
{
-
Object invoke(String resourceName, String operationName, Object... parameters) throws Exception;
void stop();
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -116,7 +116,7 @@
private HierarchicalRepository<AddressSettings> addressSettingsRepository;
- private MessagingServerControl managedServer;
+ private MessagingServerControl messagingServerControl;
private final MessageCounterManager messageCounterManager;
@@ -156,6 +156,10 @@
messageCounterManager = new MessageCounterManagerImpl();
messageCounterManager.setMaxDayCount(configuration.getMessageCounterMaxDayHistory());
messageCounterManager.reschedule(configuration.getMessageCounterSamplePeriod());
+
+ replicationInvoker = new ReplicationOperationInvokerImpl(managementClusterPassword,
+ managementAddress,
+ managementRequestTimeout);
}
// Public --------------------------------------------------------
@@ -183,21 +187,19 @@
this.securityRepository = securityRepository;
this.storageManager = storageManager;
- managedServer = new MessagingServerControl(postOffice,
- storageManager,
+ messagingServerControl = new MessagingServerControl(postOffice,
configuration,
resourceManager,
remotingService,
messagingServer,
messageCounterManager,
- broadcaster,
- queueFactory);
+ broadcaster);
ObjectName objectName = ObjectNames.getMessagingServerObjectName();
- registerInJMX(objectName, new ReplicationAwareMessagingServerControlWrapper(managedServer,
+ registerInJMX(objectName, new ReplicationAwareMessagingServerControlWrapper(messagingServerControl,
replicationInvoker));
- registerInRegistry(ResourceNames.CORE_SERVER, managedServer);
+ registerInRegistry(ResourceNames.CORE_SERVER, messagingServerControl);
- return managedServer;
+ return messagingServerControl;
}
public synchronized void unregisterServer() throws Exception
@@ -527,15 +529,11 @@
public void start() throws Exception
{
- replicationInvoker = new ReplicationOperationInvokerImpl(managementClusterPassword,
- managementAddress,
- managementRequestTimeout);
-
if (messageCounterEnabled)
{
messageCounterManager.start();
}
-
+
started = true;
}
@@ -583,7 +581,7 @@
public void sendNotification(final Notification notification) throws Exception
{
- if (managedServer != null && notificationsEnabled)
+ if (messagingServerControl != null && notificationsEnabled)
{
// This needs to be synchronized since we need to ensure notifications are processed in strict sequence
synchronized (this)
@@ -703,7 +701,9 @@
{
throw new IllegalArgumentException("no operation " + operation + "/" + params.size());
}
+
Object[] p = params.toArray(new Object[params.size()]);
+
Object result = method.invoke(resource, p);
return result;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -45,24 +45,16 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.filter.impl.FilterImpl;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.TransportConfigurationInfo;
import org.jboss.messaging.core.messagecounter.MessageCounterManager;
import org.jboss.messaging.core.messagecounter.impl.MessageCounterManagerImpl;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.Binding;
-import org.jboss.messaging.core.postoffice.BindingType;
import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.postoffice.impl.LocalQueueBinding;
import org.jboss.messaging.core.remoting.RemotingConnection;
import org.jboss.messaging.core.remoting.server.RemotingService;
import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.QueueFactory;
import org.jboss.messaging.core.server.ServerSession;
import org.jboss.messaging.core.transaction.ResourceManager;
import org.jboss.messaging.core.transaction.Transaction;
@@ -87,8 +79,6 @@
private final PostOffice postOffice;
- private final StorageManager storageManager;
-
private final Configuration configuration;
private final ResourceManager resourceManager;
@@ -101,37 +91,28 @@
private final NotificationBroadcasterSupport broadcaster;
- private final QueueFactory queueFactory;
-
private boolean messageCounterEnabled;
- private final SimpleString nodeID;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public MessagingServerControl(final PostOffice postOffice,
- final StorageManager storageManager,
+ public MessagingServerControl(final PostOffice postOffice,
final Configuration configuration,
final ResourceManager resourceManager,
final RemotingService remotingService,
final MessagingServer messagingServer,
final MessageCounterManager messageCounterManager,
- final NotificationBroadcasterSupport broadcaster,
- final QueueFactory queueFactory) throws Exception
+ final NotificationBroadcasterSupport broadcaster) throws Exception
{
- this.postOffice = postOffice;
- this.storageManager = storageManager;
+ this.postOffice = postOffice;
this.configuration = configuration;
this.resourceManager = resourceManager;
this.remotingService = remotingService;
- server = messagingServer;
+ this.server = messagingServer;
this.messageCounterManager = messageCounterManager;
this.broadcaster = broadcaster;
- this.queueFactory = queueFactory;
- this.nodeID = server.getNodeID();
- messageCounterEnabled = configuration.isMessageCounterEnabled();
+ this.messageCounterEnabled = configuration.isMessageCounterEnabled();
}
// Public --------------------------------------------------------
@@ -257,66 +238,36 @@
{
return configuration.isSecurityEnabled();
}
+
+ public void deployQueue(final String address, final String name) throws Exception
+ {
+ server.deployQueue(new SimpleString(address), new SimpleString(name), null, true, false);
+ }
- public synchronized void createQueue(final String address, final String name) throws Exception
+ public void deployQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception
{
- SimpleString sAddress = new SimpleString(address);
- SimpleString sName = new SimpleString(name);
- if (postOffice.getBinding(sName) == null)
- {
- Queue queue = queueFactory.createQueue(-1, sAddress, sName, null, true, false);
- Binding binding = new LocalQueueBinding(sAddress, queue, nodeID);
- storageManager.addQueueBinding(binding);
- postOffice.addBinding(binding);
- }
+ SimpleString filter = filterStr == null ? null : new SimpleString(filterStr);
+
+ server.deployQueue(new SimpleString(address), new SimpleString(name), filter, durable, false);
}
- public synchronized void createQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception
+ public void createQueue(final String address, final String name) throws Exception
{
- //FIXME - this should be using the createQueue method in MessagingServerImpl
- SimpleString sAddress = new SimpleString(address);
- SimpleString sName = new SimpleString(name);
- SimpleString sFilter = filterStr == null || filterStr.length() == 0 ? null : new SimpleString(filterStr);
- Filter filter = null;
- if (sFilter != null)
- {
- filter = new FilterImpl(sFilter);
- }
- if (postOffice.getBinding(sName) == null)
- {
- Queue queue = queueFactory.createQueue(-1, sAddress, sName, filter, durable, false);
- Binding binding = new LocalQueueBinding(sAddress, queue, nodeID);
- if (durable)
- {
- storageManager.addQueueBinding(binding);
- }
- postOffice.addBinding(binding);
- }
+ server.createQueue(new SimpleString(address), new SimpleString(name), null, true, false);
}
- public synchronized void destroyQueue(final String name) throws Exception
+ public void createQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception
{
- //FIXME - there should be a destroyqueue method in MessagingServreImpl that does this to avoid
- //duplicating functionality with ServerSessionImpl
- SimpleString sName = new SimpleString(name);
- Binding binding = postOffice.getBinding(sName);
+ SimpleString filter = filterStr == null ? null : new SimpleString(filterStr);
+
+ server.createQueue(new SimpleString(address), new SimpleString(name), filter, durable, false);
+ }
- if (binding != null)
- {
- if (binding.getType() == BindingType.LOCAL_QUEUE)
- {
- Queue queue = (Queue)binding.getBindable();
+ public void destroyQueue(final String name) throws Exception
+ {
+ SimpleString queueName = new SimpleString(name);
- queue.deleteAllReferences();
-
- postOffice.removeBinding(sName);
-
- if (queue.isDurable())
- {
- storageManager.deleteQueueBinding(queue.getPersistenceID());
- }
- }
- }
+ server.destroyQueue(queueName, null);
}
public int getConnectionCount()
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -54,7 +54,7 @@
// Constructors --------------------------------------------------
- public ReplicationAwareMessagingServerControlWrapper(final MessagingServerControl localControl,
+ public ReplicationAwareMessagingServerControlWrapper(final MessagingServerControl localControl,
final ReplicationOperationInvoker replicationInvoker) throws Exception
{
super(ResourceNames.CORE_SERVER, MessagingServerControlMBean.class, replicationInvoker);
@@ -193,7 +193,7 @@
{
return localControl.isMessageCounterEnabled();
}
-
+
public boolean isSecurityEnabled()
{
return localControl.isSecurityEnabled();
@@ -233,9 +233,9 @@
{
return localControl.getConnectors();
}
-
+
public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception
- {
+ {
replicationAwareInvoke("sendQueueInfoToQueue", queueName, address);
}
@@ -264,6 +264,16 @@
replicationAwareInvoke("createQueue", address, name, filter, durable);
}
+ public void deployQueue(String address, String name, String filter, boolean durable) throws Exception
+ {
+ replicationAwareInvoke("deployQueue", address, name, filter, durable);
+ }
+
+ public void deployQueue(String address, String name) throws Exception
+ {
+ replicationAwareInvoke("deployQueue", address, name);
+ }
+
public void destroyQueue(final String name) throws Exception
{
replicationAwareInvoke("destroyQueue", name);
@@ -308,7 +318,7 @@
{
replicationAwareInvoke("setMessageCounterSamplePeriod", newPeriod);
}
-
+
public long getConnectionTTLOverride()
{
return localControl.getConnectionTTLOverride();
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -24,6 +24,7 @@
import javax.management.StandardMBean;
+import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.ReplicationOperationInvoker;
/**
@@ -37,9 +38,11 @@
*/
public class ReplicationAwareStandardMBeanWrapper extends StandardMBean
{
-
// Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ReplicationAwareStandardMBeanWrapper.class);
+
// Attributes ----------------------------------------------------
private final String resourceName;
@@ -57,6 +60,7 @@
super(mbeanInterface);
this.resourceName = resourceName;
+
this.replicationInvoker = replicationInvoker;
}
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -601,11 +601,11 @@
{
if (tx == null)
{
- log.warn("Duplicate message detected - message will not be routed");
+ log.trace("Duplicate message detected - message will not be routed");
}
else
{
- log.warn("Duplicate message detected - transaction will be rejected");
+ log.trace("Duplicate message detected - transaction will be rejected");
tx.markAsRollbackOnly(null);
}
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/SimpleAddressManager.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -51,11 +51,9 @@
{
if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null)
{
- //throw new IllegalStateException("Binding already exists " + binding);
- log.error("Binding already exists " + binding.getUniqueName(), new Exception());
-
- System.exit(1);
+ throw new IllegalStateException("Binding already exists " + binding);
}
+
return addMappingInternal(binding.getAddress(), binding);
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/remoting/server/RemotingService.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -45,4 +45,6 @@
boolean removeInterceptor(Interceptor interceptor);
void freeze();
+
+ RemotingConnection getServerSideReplicatingConnection();
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/remoting/server/impl/RemotingServiceImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -82,6 +82,9 @@
private volatile MessagingServer server;
private ManagementService managementService;
+
+ private volatile RemotingConnection serverSideReplicatingConnection;
+
// Static --------------------------------------------------------
@@ -243,9 +246,14 @@
{
return new HashSet<RemotingConnection>(connections.values());
}
+
+ public RemotingConnection getServerSideReplicatingConnection()
+ {
+ return serverSideReplicatingConnection;
+ }
// ConnectionLifeCycleListener implementation -----------------------------------
-
+
public void connectionCreated(final Connection connection)
{
if (server == null)
@@ -263,7 +271,12 @@
Object id = connection.getID();
- connections.put(id, rc);
+ connections.put(id, rc);
+
+ if (config.isBackup())
+ {
+ serverSideReplicatingConnection = rc;
+ }
}
public void connectionDestroyed(final Object connectionID)
@@ -277,12 +290,14 @@
public void connectionException(final Object connectionID, final MessagingException me)
{
- RemotingConnection rc = connections.remove(connectionID);
-
- if (rc != null)
- {
- rc.fail(me);
- }
+ //We DO NOT call fail on connection exception, otherwise in event of real connection failure, the
+ //connection will be failed, the session will be closed and won't be able to reconnect
+
+ //E.g. if live server fails, then this handler wil be called on backup server for the server
+ //side replicating connection.
+ //If the connection fail() is called then the sessions on the backup will get closed.
+
+ //Connections should only fail when TTL is exceeded
}
public void addInterceptor(final Interceptor interceptor)
Modified: trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -64,8 +64,10 @@
MessagingServerControl getMessagingServerControl();
- DeploymentManager getDeploymentManager();
-
+ void registerActivateCallback(ActivateCallback callback);
+
+ void unregisterActivateCallback(ActivateCallback callback);
+
ReattachSessionResponseMessage reattachSession(RemotingConnection connection, String name, int lastReceivedCommandID) throws Exception;
CreateSessionResponseMessage createSession(String name,
@@ -134,5 +136,13 @@
boolean durable,
boolean temporary) throws Exception;
+ Queue deployQueue(SimpleString address,
+ SimpleString queueName,
+ SimpleString filterString,
+ boolean durable,
+ boolean temporary) throws Exception;
+
+ void destroyQueue(SimpleString queueName, ServerSession session) throws Exception;
+
void handleReplicateRedistribution(final SimpleString queueName, final long messageID) throws Exception;
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -233,7 +233,7 @@
{
return;
}
-
+
if (discoveryGroup != null)
{
discoveryGroup.registerListener(this);
@@ -335,11 +335,6 @@
private void updateConnectors(final Map<String, DiscoveryEntry> connectors) throws Exception
{
- // Set<Pair<TransportConfiguration, TransportConfiguration>> connectorSet = new
- // HashSet<Pair<TransportConfiguration, TransportConfiguration>>();
-
- // connectorSet.addAll(connectors);
-
Iterator<Map.Entry<String, MessageFlowRecord>> iter = records.entrySet().iterator();
while (iter.hasNext())
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -73,10 +73,12 @@
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.remoting.spi.ConnectorFactory;
+import org.jboss.messaging.core.security.CheckType;
import org.jboss.messaging.core.security.JBMSecurityManager;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.security.SecurityStore;
import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
+import org.jboss.messaging.core.server.ActivateCallback;
import org.jboss.messaging.core.server.Divert;
import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.MessagingServer;
@@ -132,12 +134,14 @@
private final Configuration configuration;
private final MBeanServer mbeanServer;
+
+ private final Set<ActivateCallback> activateCallbacks = new HashSet<ActivateCallback>();
private volatile boolean started;
private SecurityStore securityStore;
- private final HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>();
+ private final HierarchicalRepository<AddressSettings> addressSettingsRepository;
private ScheduledExecutorService scheduledExecutor;
@@ -212,7 +216,7 @@
{
throw new NullPointerException("Must inject SecurityManager into MessagingServer constructor");
}
-
+
// We need to hard code the version information into a source file
version = VersionLoader.getVersion();
@@ -221,270 +225,17 @@
this.mbeanServer = mbeanServer;
- this.securityManager = securityManager;
+ this.securityManager = securityManager;
+
+ this.addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>();
+
+ addressSettingsRepository.setDefault(new AddressSettings());
}
// lifecycle methods
// ----------------------------------------------------------------
- private void doStart() throws Exception
- {
- asyncDeliveryPool = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("JBM-async-session-delivery-threads"));
-
- executorFactory = new org.jboss.messaging.utils.OrderedExecutorFactory(asyncDeliveryPool);
-
- if (configuration.isEnablePersistence())
- {
- storageManager = new JournalStorageManager(configuration);
- }
- else
- {
- storageManager = new NullStorageManager();
- }
-
- storageManager.start();
-
- securityManager.start();
-
- initialised = !configuration.isBackup();
-
- securityRepository = new HierarchicalObjectRepository<Set<Role>>();
- securityRepository.setDefault(new HashSet<Role>());
-
- securityStore = new SecurityStoreImpl(securityRepository,
- securityManager,
- configuration.getSecurityInvalidationInterval(),
- configuration.isSecurityEnabled(),
- configuration.getManagementClusterPassword(),
- managementService);
-
- addressSettingsRepository.setDefault(new AddressSettings());
- scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
- new org.jboss.messaging.utils.JBMThreadFactory("JBM-scheduled-threads"));
- queueFactory = new QueueFactoryImpl(scheduledExecutor, addressSettingsRepository, storageManager);
-
- pagingManager = createPagingManager();
-
- resourceManager = new ResourceManagerImpl((int)configuration.getTransactionTimeout() / 1000,
- configuration.getTransactionTimeoutScanPeriod());
- postOffice = new PostOfficeImpl(this,
- storageManager,
- pagingManager,
- queueFactory,
- managementService,
- configuration.getMessageExpiryScanPeriod(),
- configuration.getMessageExpiryThreadPriority(),
- configuration.isWildcardRoutingEnabled(),
- configuration.isBackup(),
- configuration.getIDCacheSize(),
- configuration.isPersistIDCache(),
- executorFactory,
- addressSettingsRepository);
-
- postOffice.start();
-
- pagingManager.start();
-
- managementService.start();
-
- // Start the deployers
- if (configuration.isEnableFileDeployment())
- {
- basicUserCredentialsDeployer = new BasicUserCredentialsDeployer(deploymentManager, securityManager);
-
- addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager, addressSettingsRepository);
-
- queueDeployer = new QueueDeployer(deploymentManager, configuration);
-
- securityDeployer = new SecurityDeployer(deploymentManager, securityRepository);
-
- basicUserCredentialsDeployer.start();
-
- addressSettingsDeployer.start();
-
- queueDeployer.start();
-
- securityDeployer.start();
- }
-
- List<QueueBindingInfo> queueBindingInfos = new ArrayList<QueueBindingInfo>();
-
- storageManager.loadBindingJournal(queueBindingInfos);
-
- if (!configuration.isBackup())
- {
- if (uuid == null)
- {
- uuid = storageManager.getPersistentID();
-
- if (uuid == null)
- {
- uuid = UUIDGenerator.getInstance().generateUUID();
-
- storageManager.setPersistentID(uuid);
- }
-
- nodeID = new SimpleString(uuid.toString());
- }
- }
- else
- {
- UUID currentUUID = storageManager.getPersistentID();
-
- if (currentUUID != null)
- {
- if (!currentUUID.equals(uuid))
- {
- throw new IllegalStateException("Backup server already has an id but it's not the same as live");
- }
- }
- else
- {
- storageManager.setPersistentID(uuid);
- }
- }
-
- messagingServerControl = managementService.registerServer(postOffice,
- storageManager,
- configuration,
- addressSettingsRepository,
- securityRepository,
- resourceManager,
- remotingService,
- this,
- queueFactory,
- configuration.isBackup());
-
- Map<Long, Queue> queues = new HashMap<Long, Queue>();
-
- for (QueueBindingInfo queueBindingInfo : queueBindingInfos)
- {
- Filter filter = null;
-
- if (queueBindingInfo.getFilterString() != null)
- {
- filter = new FilterImpl(queueBindingInfo.getFilterString());
- }
-
- Queue queue = queueFactory.createQueue(queueBindingInfo.getPersistenceID(),
- queueBindingInfo.getAddress(),
- queueBindingInfo.getQueueName(),
- filter,
- true,
- false);
-
- Binding binding = new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeID);
-
- queues.put(queueBindingInfo.getPersistenceID(), queue);
-
- postOffice.addBinding(binding);
- }
-
- Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<SimpleString, List<Pair<byte[], Long>>>();
-
- storageManager.loadMessageJournal(pagingManager,
- resourceManager,
- queues,
- duplicateIDMap);
-
- for (Map.Entry<SimpleString, List<Pair<byte[], Long>>> entry : duplicateIDMap.entrySet())
- {
- SimpleString address = entry.getKey();
-
- DuplicateIDCache cache = postOffice.getDuplicateIDCache(address);
-
- if (configuration.isPersistIDCache())
- {
- cache.load(entry.getValue());
- }
- }
-
- resourceManager.start();
-
- // Deply any pre-defined diverts
- deployDiverts();
-
- String backupConnectorName = configuration.getBackupConnectorName();
-
- if (backupConnectorName != null)
- {
- TransportConfiguration backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
-
- if (backupConnector == null)
- {
- log.warn("connector with name '" + backupConnectorName + "' is not defined in the configuration.");
- }
- else
- {
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class<?> clz = loader.loadClass(backupConnector.getFactoryClassName());
- backupConnectorFactory = (ConnectorFactory)clz.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Error instantiating interceptor \"" + backupConnector.getFactoryClassName() +
- "\"",
- e);
- }
-
- backupConnectorParams = backupConnector.getParams();
- }
- }
-
- Channel replicatingChannel = getReplicatingChannel();
-
- if (replicatingChannel == null && backupConnectorFactory != null)
- {
- log.warn("Please start backup server before starting live server");
-
- remotingService.stop();
-
- return;
- }
-
- if (configuration.isClustered())
- {
- clusterManager = new ClusterManagerImpl(executorFactory,
- this,
- postOffice,
- scheduledExecutor,
- managementService,
- configuration,
- uuid,
- replicatingChannel,
- configuration.isBackup());
- }
-
- // We need to startDepage when we restart the server to eventually resume destinations that were in depage mode
- // during last stop
- // This is the last thing done at the start, after everything else is up and running
- pagingManager.startGlobalDepage();
-
- if (!configuration.isBackup())
- {
- if (deploymentManager != null)
- {
- deploymentManager.start();
- }
-
- // Once we ready we can start the remoting service so we can start accepting connections
- remotingService.start();
-
- // Deploy any pre-defined queues - must be done *after* deploymentManager has started
- deployQueues();
- }
-
- if (clusterManager != null)
- {
- clusterManager.start();
- }
-
- started = true;
- }
-
+
public synchronized void start() throws Exception
{
if (started)
@@ -492,27 +243,21 @@
return;
}
- managementService = new ManagementServiceImpl(mbeanServer, configuration);
+ initialisePart1();
- remotingService = new RemotingServiceImpl(configuration, this, managementService);
-
- if (configuration.isEnableFileDeployment())
- {
- // We need to create it now but not start it
- deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
- }
-
if (configuration.isBackup())
{
- remotingService.start();
-
// We defer actually initialisation until the live node has contacted the backup
log.info("Backup server will await live server before becoming operational");
}
else
{
- doStart();
+ initialisePart2();
}
+
+ // We start the remoting service here - if the server is a backup remoting service needs to be started
+ // so it can be initialised by the live node
+ remotingService.start();
}
public synchronized void stop() throws Exception
@@ -521,7 +266,7 @@
{
return;
}
-
+
if (clusterManager != null)
{
clusterManager.stop();
@@ -665,72 +410,8 @@
public ClusterManager getClusterManager()
{
return clusterManager;
- }
+ }
- private void checkActivate(final RemotingConnection connection)
- {
- if (configuration.isBackup())
- {
- synchronized (this)
- {
- freezeBackupConnection();
-
- List<Queue> toActivate = postOffice.activate();
-
- for (Queue queue : toActivate)
- {
- scheduledExecutor.schedule(new ActivateRunner(queue),
- configuration.getQueueActivationTimeout(),
- TimeUnit.MILLISECONDS);
- }
-
- configuration.setBackup(false);
-
- if (clusterManager != null)
- {
- clusterManager.activate();
- }
- }
- }
-
- connection.activate();
- }
-
- // We need to prevent any more packets being handled on replicating connection as soon as first live connection
- // is created or re-attaches, to prevent a situation like the following:
- // connection 1 create queue A
- // connection 2 fails over
- // A gets activated since no consumers
- // connection 1 create consumer on A
- // connection 1 delivery
- // connection 1 delivery gets replicated
- // can't find message in queue since active was delivered immediately
- private void freezeBackupConnection()
- {
- // Sanity check
- // All replicated sessions should be on the same connection
- RemotingConnection replConnection = null;
-
- for (ServerSession session : sessions.values())
- {
- RemotingConnection rc = session.getChannel().getConnection();
-
- if (replConnection == null)
- {
- replConnection = rc;
- }
- else if (replConnection != rc)
- {
- throw new IllegalStateException("More than one replicating connection!");
- }
- }
-
- if (replConnection != null)
- {
- replConnection.freeze();
- }
- }
-
public ReattachSessionResponseMessage reattachSession(final RemotingConnection connection,
final String name,
final int lastReceivedCommandID) throws Exception
@@ -873,31 +554,23 @@
this.nodeID = new SimpleString(uuid.toString());
- doStart();
+ initialisePart2();
- initialised = true;
-
- if (deploymentManager != null)
- {
- deploymentManager.start();
- }
-
if (currentMessageID != this.storageManager.getCurrentUniqueID())
{
+ initialised = false;
+
throw new IllegalStateException("Backup node current id sequence != live node current id sequence " + this.storageManager.getCurrentUniqueID() +
", " +
currentMessageID);
}
- //Queues must be deployed *after* deploymentManager has started
- deployQueues();
-
log.info("Backup server is now operational");
}
}
-
+
public Channel getReplicatingChannel()
- {
+ {
synchronized (replicatingChannelLock)
{
if (replicatingChannel == null && backupConnectorFactory != null)
@@ -985,69 +658,103 @@
return nodeID;
}
- public Queue createQueue(final SimpleString address,
- final SimpleString queueName,
- final SimpleString filterString,
- final boolean durable,
- final boolean temporary) throws Exception
+ public void handleReplicateRedistribution(final SimpleString queueName, final long messageID) throws Exception
{
Binding binding = postOffice.getBinding(queueName);
-
- if (binding != null)
+
+ if (binding == null)
{
- throw new MessagingException(MessagingException.QUEUE_EXISTS);
+ throw new IllegalStateException("Cannot find queue " + queueName);
}
- Filter filter = null;
+ Queue queue = (Queue)binding.getBindable();
- if (filterString != null)
- {
- filter = new FilterImpl(filterString);
- }
+ MessageReference reference = queue.removeFirstReference(messageID);
- final Queue queue = queueFactory.createQueue(-1, address, queueName, filter, durable, temporary);
+ Transaction tx = new TransactionImpl(storageManager);
- binding = new LocalQueueBinding(address, queue, nodeID);
+ boolean routed = postOffice.redistribute(reference.getMessage(), queue.getName(), tx);
- if (durable)
+ if (routed)
{
- storageManager.addQueueBinding(binding);
+ queue.acknowledge(tx, reference);
+
+ tx.commit();
}
+ else
+ {
+ throw new IllegalStateException("Must be routed");
+ }
+ }
- postOffice.addBinding(binding);
+ public Queue createQueue(final SimpleString address,
+ final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean durable,
+ final boolean temporary) throws Exception
+ {
+ return createQueue(address, queueName, filterString, durable, temporary, false);
+ }
- return queue;
+ public Queue deployQueue(final SimpleString address,
+ final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean durable,
+ final boolean temporary) throws Exception
+ {
+ return createQueue(address, queueName, filterString, durable, temporary, true);
}
- public void handleReplicateRedistribution(final SimpleString queueName, final long messageID) throws Exception
+ public void destroyQueue(final SimpleString queueName, final ServerSession session) throws Exception
{
Binding binding = postOffice.getBinding(queueName);
-
+
if (binding == null)
{
- throw new IllegalStateException("Cannot find queue " + queueName);
+ throw new MessagingException(MessagingException.QUEUE_DOES_NOT_EXIST, "No such queue " + queueName);
}
Queue queue = (Queue)binding.getBindable();
- MessageReference reference = queue.removeFirstReference(messageID);
+ if (queue.getConsumerCount() != 0)
+ {
+ throw new MessagingException(MessagingException.ILLEGAL_STATE, "Cannot delete queue - it has consumers");
+ }
- Transaction tx = new TransactionImpl(storageManager);
+ if (session != null)
+ {
+ if (queue.isDurable())
+ {
+ // make sure the user has privileges to delete this queue
+ securityStore.check(binding.getAddress(), CheckType.DELETE_DURABLE_QUEUE, session);
+ }
+ else
+ {
+ securityStore.check(binding.getAddress(), CheckType.DELETE_NON_DURABLE_QUEUE, session);
+ }
+ }
- boolean routed = postOffice.redistribute(reference.getMessage(), queue.getName(), tx);
+ queue.deleteAllReferences();
- if (routed)
+ if (queue.isDurable())
{
- queue.acknowledge(tx, reference);
+ storageManager.deleteQueueBinding(queue.getPersistenceID());
+ }
- tx.commit();
- }
- else
- {
- throw new IllegalStateException("Must be routed");
- }
+ postOffice.removeBinding(queueName);
}
+
+ public synchronized void registerActivateCallback(final ActivateCallback callback)
+ {
+ activateCallbacks.add(callback);
+ }
+ public synchronized void unregisterActivateCallback(final ActivateCallback callback)
+ {
+ activateCallbacks.remove(callback);
+ }
+
+
// Public
// ---------------------------------------------------------------------------------------
@@ -1057,9 +764,6 @@
// Protected
// ------------------------------------------------------------------------------------
- /**
- * Method could be replaced for test purposes
- */
protected PagingManager createPagingManager()
{
return new PagingManagerImpl(new PagingStoreFactoryNIO(configuration.getPagingDirectory(),
@@ -1075,55 +779,431 @@
// Private
// --------------------------------------------------------------------------------------
- private void deployQueues() throws Exception
+ private synchronized void callActivateCallbacks()
{
- for (QueueConfiguration config : configuration.getQueueConfigurations())
+ for (ActivateCallback callback: activateCallbacks)
{
- if (config.getName() == null)
+ callback.activated();
+ }
+ }
+
+ private void checkActivate(final RemotingConnection connection)
+ {
+ if (configuration.isBackup())
+ {
+ synchronized (this)
{
- log.warn("Must specify a unique name for each queue. This one will not be deployed.");
+ freezeBackupConnection();
- continue;
+ List<Queue> toActivate = postOffice.activate();
+
+ for (Queue queue : toActivate)
+ {
+ scheduledExecutor.schedule(new ActivateRunner(queue),
+ configuration.getQueueActivationTimeout(),
+ TimeUnit.MILLISECONDS);
+ }
+
+ configuration.setBackup(false);
+
+ if (clusterManager != null)
+ {
+ clusterManager.activate();
+ }
}
+ }
- if (config.getAddress() == null)
+ connection.activate();
+ }
+
+ // We need to prevent any more packets being handled on replicating connection as soon as first live connection
+ // is created or re-attaches, to prevent a situation like the following:
+ // connection 1 create queue A
+ // connection 2 fails over
+ // A gets activated since no consumers
+ // connection 1 create consumer on A
+ // connection 1 delivery
+ // connection 1 delivery gets replicated
+ // can't find message in queue since active was delivered immediately
+ private void freezeBackupConnection()
+ {
+ // Sanity check
+ // All replicated sessions should be on the same connection
+ RemotingConnection replConnection = null;
+
+ for (ServerSession session : sessions.values())
+ {
+ RemotingConnection rc = session.getChannel().getConnection();
+
+ if (replConnection == null)
{
- log.warn("Must specify an address for each queue. This one will not be deployed.");
-
- continue;
+ replConnection = rc;
}
+ else if (replConnection != rc)
+ {
+ throw new IllegalStateException("More than one replicating connection!");
+ }
+ }
- SimpleString name = new SimpleString(config.getName());
+ if (replConnection != null)
+ {
+ replConnection.freeze();
+ }
+ }
+
+ private void initialisePart1() throws Exception
+ {
+ managementService = new ManagementServiceImpl(mbeanServer, configuration);
- SimpleString address = new SimpleString(config.getAddress());
+ remotingService = new RemotingServiceImpl(configuration, this, managementService);
+ }
- Binding binding = postOffice.getBinding(name);
+ private void initialisePart2() throws Exception
+ {
+ // Create the pools and executor related objects
+ asyncDeliveryPool = Executors.newCachedThreadPool(new org.jboss.messaging.utils.JBMThreadFactory("JBM-async-session-delivery-threads"));
- if (binding == null)
+ executorFactory = new org.jboss.messaging.utils.OrderedExecutorFactory(asyncDeliveryPool);
+
+ scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
+ new org.jboss.messaging.utils.JBMThreadFactory("JBM-scheduled-threads"));
+
+ // Create the hard-wired components
+
+ if (configuration.isEnableFileDeployment())
+ {
+ deploymentManager = new FileDeploymentManager(configuration.getFileDeployerScanPeriod());
+ }
+
+ if (configuration.isEnablePersistence())
+ {
+ storageManager = new JournalStorageManager(configuration);
+ }
+ else
+ {
+ storageManager = new NullStorageManager();
+ }
+
+ securityRepository = new HierarchicalObjectRepository<Set<Role>>();
+ securityRepository.setDefault(new HashSet<Role>());
+
+ securityStore = new SecurityStoreImpl(securityRepository,
+ securityManager,
+ configuration.getSecurityInvalidationInterval(),
+ configuration.isSecurityEnabled(),
+ configuration.getManagementClusterPassword(),
+ managementService);
+
+ queueFactory = new QueueFactoryImpl(scheduledExecutor, addressSettingsRepository, storageManager);
+
+ pagingManager = createPagingManager();
+
+ resourceManager = new ResourceManagerImpl((int)(configuration.getTransactionTimeout() / 1000),
+ configuration.getTransactionTimeoutScanPeriod());
+ postOffice = new PostOfficeImpl(this,
+ storageManager,
+ pagingManager,
+ queueFactory,
+ managementService,
+ configuration.getMessageExpiryScanPeriod(),
+ configuration.getMessageExpiryThreadPriority(),
+ configuration.isWildcardRoutingEnabled(),
+ configuration.isBackup(),
+ configuration.getIDCacheSize(),
+ configuration.isPersistIDCache(),
+ executorFactory,
+ addressSettingsRepository);
+
+ messagingServerControl = managementService.registerServer(postOffice,
+ storageManager,
+ configuration,
+ addressSettingsRepository,
+ securityRepository,
+ resourceManager,
+ remotingService,
+ this,
+ queueFactory,
+ configuration.isBackup());
+
+ // Address settings need to deployed initially, since they're require on paging manager.start()
+
+ if (configuration.isEnableFileDeployment())
+ {
+ addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager, addressSettingsRepository);
+
+ addressSettingsDeployer.start();
+ }
+
+ storageManager.start();
+
+ securityManager.start();
+
+ postOffice.start();
+
+ pagingManager.start();
+
+ log.info("starting management service");
+ managementService.start();
+
+ resourceManager.start();
+
+ // Deploy all security related config
+ if (configuration.isEnableFileDeployment())
+ {
+ basicUserCredentialsDeployer = new BasicUserCredentialsDeployer(deploymentManager, securityManager);
+
+ securityDeployer = new SecurityDeployer(deploymentManager, securityRepository);
+
+ basicUserCredentialsDeployer.start();
+
+ securityDeployer.start();
+ }
+
+ // Load the journal and populate queues, transactions and caches in memory
+ loadJournal();
+
+ // Deploy any queues in the Configuration class - if there's no file deployment we still need
+ // to load those
+ deployQueuesFromConfiguration();
+
+ // Deploy any predefined queues - on backup we don't start queue deployer - instead deployments
+ // are replicated from live
+
+ if (configuration.isEnableFileDeployment() && !configuration.isBackup())
+ {
+ queueDeployer = new QueueDeployer(deploymentManager, messagingServerControl);
+
+ queueDeployer.start();
+ }
+
+ // We need to call this here, this gives any dependent server a chance to deploy its own destinations
+ // this needs to be done before clustering is initialised, and in the same order on live and backup
+ callActivateCallbacks();
+
+ // Deply any pre-defined diverts
+ deployDiverts();
+
+ // Set-up the replicating connection
+ if (!setupReplicatingConnection())
+ {
+ return;
+ }
+
+ if (configuration.isClustered())
+ {
+ // This can't be created until node id is set
+ clusterManager = new ClusterManagerImpl(executorFactory,
+ this,
+ postOffice,
+ scheduledExecutor,
+ managementService,
+ configuration,
+ uuid,
+ replicatingChannel,
+ configuration.isBackup());
+
+ clusterManager.start();
+ }
+
+ if (deploymentManager != null)
+ {
+ deploymentManager.start();
+ }
+
+ pagingManager.startGlobalDepage();
+
+ initialised = true;
+
+ started = true;
+ }
+
+ private void deployQueuesFromConfiguration() throws Exception
+ {
+ for (QueueConfiguration config : configuration.getQueueConfigurations())
+ {
+ messagingServerControl.deployQueue(config.getAddress(),
+ config.getName(),
+ config.getFilterString(),
+ config.isDurable());
+ }
+ }
+
+ private boolean setupReplicatingConnection() throws Exception
+ {
+ String backupConnectorName = configuration.getBackupConnectorName();
+
+ if (backupConnectorName != null)
+ {
+ TransportConfiguration backupConnector = configuration.getConnectorConfigurations().get(backupConnectorName);
+
+ if (backupConnector == null)
{
- Filter filter = null;
+ log.warn("connector with name '" + backupConnectorName + "' is not defined in the configuration.");
+ }
+ else
+ {
- if (config.getFilterString() != null)
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
{
- filter = new FilterImpl(new SimpleString(config.getFilterString()));
+ Class<?> clz = loader.loadClass(backupConnector.getFactoryClassName());
+ backupConnectorFactory = (ConnectorFactory)clz.newInstance();
}
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating interceptor \"" + backupConnector.getFactoryClassName() +
+ "\"",
+ e);
+ }
- Queue queue = queueFactory.createQueue(-1, address, name, filter, config.isDurable(), false);
+ backupConnectorParams = backupConnector.getParams();
+ }
+ }
- Binding queueBinding = new LocalQueueBinding(new SimpleString(config.getAddress()), queue, nodeID);
+ Channel replicatingChannel = getReplicatingChannel();
- binding = queueBinding;
+ if (replicatingChannel == null && backupConnectorFactory != null)
+ {
+ log.warn("Backup server MUST be started before live server. Initialisation will proceed.");
- postOffice.addBinding(binding);
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
- if (config.isDurable())
+ private void loadJournal() throws Exception
+ {
+ List<QueueBindingInfo> queueBindingInfos = new ArrayList<QueueBindingInfo>();
+
+ storageManager.loadBindingJournal(queueBindingInfos);
+
+ // Set the node id - must be before we load the queues into the postoffice, but after we load the journal
+ setNodeID();
+
+ Map<Long, Queue> queues = new HashMap<Long, Queue>();
+
+ for (QueueBindingInfo queueBindingInfo : queueBindingInfos)
+ {
+ Filter filter = null;
+
+ if (queueBindingInfo.getFilterString() != null)
+ {
+ filter = new FilterImpl(queueBindingInfo.getFilterString());
+ }
+
+ Queue queue = queueFactory.createQueue(queueBindingInfo.getPersistenceID(),
+ queueBindingInfo.getAddress(),
+ queueBindingInfo.getQueueName(),
+ filter,
+ true,
+ false);
+
+ Binding binding = new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeID);
+
+ queues.put(queueBindingInfo.getPersistenceID(), queue);
+
+ postOffice.addBinding(binding);
+ }
+
+ Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<SimpleString, List<Pair<byte[], Long>>>();
+
+ storageManager.loadMessageJournal(pagingManager, resourceManager, queues, duplicateIDMap);
+
+ for (Map.Entry<SimpleString, List<Pair<byte[], Long>>> entry : duplicateIDMap.entrySet())
+ {
+ SimpleString address = entry.getKey();
+
+ DuplicateIDCache cache = postOffice.getDuplicateIDCache(address);
+
+ if (configuration.isPersistIDCache())
+ {
+ cache.load(entry.getValue());
+ }
+ }
+ }
+
+ private void setNodeID() throws Exception
+ {
+ if (!configuration.isBackup())
+ {
+ if (uuid == null)
+ {
+ uuid = storageManager.getPersistentID();
+
+ if (uuid == null)
{
- storageManager.addQueueBinding(queueBinding);
+ uuid = UUIDGenerator.getInstance().generateUUID();
+
+ storageManager.setPersistentID(uuid);
}
- }
+
+ nodeID = new SimpleString(uuid.toString());
+ }
}
+ else
+ {
+ UUID currentUUID = storageManager.getPersistentID();
+
+ if (currentUUID != null)
+ {
+ if (!currentUUID.equals(uuid))
+ {
+ throw new IllegalStateException("Backup server already has an id but it's not the same as live");
+ }
+ }
+ else
+ {
+ storageManager.setPersistentID(uuid);
+ }
+ }
}
+
+ private Queue createQueue(final SimpleString address,
+ final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean durable,
+ final boolean temporary,
+ final boolean ignoreIfExists) throws Exception
+ {
+ Binding binding = postOffice.getBinding(queueName);
+
+ if (binding != null)
+ {
+ if (ignoreIfExists)
+ {
+ return null;
+ }
+ else
+ {
+ throw new MessagingException(MessagingException.QUEUE_EXISTS);
+ }
+ }
+
+ Filter filter = null;
+
+ if (filterString != null)
+ {
+ filter = new FilterImpl(filterString);
+ }
+
+ final Queue queue = queueFactory.createQueue(-1, address, queueName, filter, durable, temporary);
+
+ binding = new LocalQueueBinding(address, queue, nodeID);
+
+ if (durable)
+ {
+ storageManager.addQueueBinding(binding);
+ }
+
+ postOffice.addBinding(binding);
+
+ return queue;
+ }
+
private void deployDiverts() throws Exception
{
for (DivertConfiguration config : configuration.getDivertConfigurations())
@@ -1165,7 +1245,7 @@
Filter filter = null;
if (config.getFilterString() != null)
- {
+ {
filter = new FilterImpl(new SimpleString(config.getFilterString()));
}
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -360,7 +360,7 @@
public void addLast(final MessageReference ref)
{
- add(ref, false);
+ add(ref, false);
}
public void addFirst(final MessageReference ref)
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerConsumerImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -430,11 +430,9 @@
// force a depage
if (!store.readPage()) // This returns false if there are no pages
{
- throw new IllegalStateException("Cannot find ref " + messageID +
- " server " +
- System.identityHashCode(server) +
- " queue " +
- this.messageQueue.getName());
+ throw new IllegalStateException("Cannot find ref " + messageID +
+ " in queue " +
+ messageQueue.getName());
}
else
{
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -377,8 +377,7 @@
public void handleCreateQueue(final CreateQueueMessage packet)
{
if (replicatingChannel == null)
- {
-
+ {
doHandleCreateQueue(packet);
}
else
@@ -1091,7 +1090,7 @@
{
try
{
- log.warn("Client connection failed, clearing up resources for session " + name);
+ log.warn("Client connection failed, clearing up resources for session " + name, new Exception());
for (Runnable runner : failureRunners)
{
@@ -1352,39 +1351,15 @@
try
{
- //server.deleteQueue(name);
-
- Binding binding = postOffice.removeBinding(name);
+ Binding binding = postOffice.getBinding(name);
if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE)
{
throw new MessagingException(MessagingException.QUEUE_DOES_NOT_EXIST);
}
- Queue queue = (Queue)binding.getBindable();
+ server.destroyQueue(name, this);
- if (queue.getConsumerCount() != 0)
- {
- throw new MessagingException(MessagingException.ILLEGAL_STATE, "Cannot delete queue - it has consumers");
- }
-
- if (queue.isDurable())
- {
- // make sure the user has privileges to delete this queue
- securityStore.check(binding.getAddress(), CheckType.DELETE_DURABLE_QUEUE, this);
- }
- else
- {
- securityStore.check(binding.getAddress(), CheckType.DELETE_NON_DURABLE_QUEUE, this);
- }
-
- queue.deleteAllReferences();
-
- if (queue.isDurable())
- {
- storageManager.deleteQueueBinding(queue.getPersistenceID());
- }
-
response = new NullResponseMessage();
}
catch (Exception e)
@@ -1476,11 +1451,6 @@
Bindings bindings = postOffice.getMatchingBindings(address);
- for (Binding binding: bindings.getBindings())
- {
- log.info("Got binding " + binding.getAddress() + " : " + binding.getUniqueName());
- }
-
for (Binding binding : bindings.getBindings())
{
if (binding.getType() == BindingType.LOCAL_QUEUE)
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -210,9 +210,9 @@
this.failoverOnServerShutdown = ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
}
- public JBossConnectionFactory(final String discoveryGroupName, final int discoveryGroupPort)
+ public JBossConnectionFactory(final String discoveryGroupAddress, final int discoveryGroupPort)
{
- this(discoveryGroupName,
+ this(discoveryGroupAddress,
discoveryGroupPort,
ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT,
ClientSessionFactoryImpl.DEFAULT_DISCOVERY_INITIAL_WAIT);
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -12,6 +12,9 @@
package org.jboss.messaging.jms.server.impl;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
@@ -20,13 +23,11 @@
import org.jboss.messaging.core.deployers.impl.XmlDeployer;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.jms.server.JMSServerManager;
+import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.utils.Pair;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
@@ -37,7 +38,7 @@
private final Configuration configuration;
- private JMSServerManager jmsServerManager;
+ private JMSServerManager jmsServerControl;
private static final String CLIENTID_ELEMENT = "client-id";
@@ -103,7 +104,7 @@
{
super(deploymentManager);
- this.jmsServerManager = jmsServerManager;
+ this.jmsServerControl = jmsServerManager;
this.configuration = config;
}
@@ -340,7 +341,7 @@
if (discoveryGroupConfiguration != null)
{
- jmsServerManager.createConnectionFactory(name,
+ jmsServerControl.createConnectionFactory(name,
discoveryGroupConfiguration,
discoveryInitialWait,
connectionLoadBalancingPolicyClassName,
@@ -369,7 +370,7 @@
}
else
{
- jmsServerManager.createConnectionFactory(name,
+ jmsServerControl.createConnectionFactory(name,
connectorConfigs,
connectionLoadBalancingPolicyClassName,
pingPeriod,
@@ -407,7 +408,7 @@
if (ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
{
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- jmsServerManager.createQueue(queueName, jndiName);
+ jmsServerControl.createQueue(queueName, jndiName);
}
}
}
@@ -422,7 +423,7 @@
if (ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
{
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- jmsServerManager.createTopic(topicName, jndiName);
+ jmsServerControl.createTopic(topicName, jndiName);
}
}
}
@@ -440,17 +441,17 @@
if (node.getNodeName().equals(CONNECTION_FACTORY_NODE_NAME))
{
String cfName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerManager.destroyConnectionFactory(cfName);
+ jmsServerControl.destroyConnectionFactory(cfName);
}
else if (node.getNodeName().equals(QUEUE_NODE_NAME))
{
String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerManager.undeployDestination(queueName);
+ jmsServerControl.undeployDestination(queueName);
}
else if (node.getNodeName().equals(TOPIC_NODE_NAME))
{
String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerManager.undeployDestination(topicName);
+ jmsServerControl.undeployDestination(topicName);
}
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -38,7 +38,9 @@
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
import org.jboss.messaging.core.deployers.Deployer;
import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.deployers.impl.FileDeploymentManager;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.server.ActivateCallback;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
@@ -56,7 +58,7 @@
* @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
*/
-public class JMSServerManagerImpl implements JMSServerManager
+public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
{
private static final Logger log = Logger.getLogger(JMSServerManagerImpl.class);
@@ -75,19 +77,47 @@
private final MessagingServer server;
- private final JMSManagementService managementService;
+ private JMSManagementService jmsManagementService;
private Deployer jmsDeployer;
private boolean started;
- public JMSServerManagerImpl(final MessagingServer server)
+ private boolean active;
+
+ private DeploymentManager deploymentManager;
+
+ public JMSServerManagerImpl(final MessagingServer server) throws Exception
{
this.server = server;
+ }
- managementService = new JMSManagementServiceImpl(server.getManagementService());
+ // ActivateCallback implementation -------------------------------------
+
+ public synchronized void activated()
+ {
+ active = true;
+
+ jmsManagementService = new JMSManagementServiceImpl(server.getManagementService());
+
+ try
+ {
+ jmsManagementService.registerJMSServer(this);
+
+ jmsDeployer = new JMSServerDeployer(this, deploymentManager, server.getConfiguration());
+
+ jmsDeployer.start();
+
+ deploymentManager.start();
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to start jms deployer");
+ }
}
+ // MessagingComponent implementation -----------------------------------
+
public synchronized void start() throws Exception
{
if (started)
@@ -95,53 +125,52 @@
return;
}
- try
+ if (context == null)
{
context = new InitialContext();
}
- catch (NamingException e)
- {
- log.error("Unable to create Initial Context", e);
- }
- managementService.registerJMSServer(this);
-
- // The deployment manager is started in the core server - this is necessary since
- // we can't start any deployments until backup server is initialised
- DeploymentManager deploymentManager = server.getDeploymentManager();
-
- if (deploymentManager != null)
- {
- jmsDeployer = new JMSServerDeployer(this, deploymentManager, server.getConfiguration());
-
- jmsDeployer.start();
- }
+
+ deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
+
+ server.registerActivateCallback(this);
+
+ server.start();
+
started = true;
}
- // MessagingComponent implementation -----------------------------------
-
public synchronized void stop() throws Exception
{
if (!started)
{
return;
}
+
if (jmsDeployer != null)
{
jmsDeployer.stop();
}
+
+ deploymentManager.stop();
+
for (String destination : destinations.keySet())
{
undeployDestination(destination);
}
+
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet()))
{
destroyConnectionFactory(connectionFactory);
}
+
destinations.clear();
connectionFactories.clear();
connectionFactoryBindings.clear();
+
context.close();
+
+ server.stop();
+
started = false;
}
@@ -152,29 +181,29 @@
// JMSServerManager implementation -------------------------------
- public void setContext(final Context context)
+ public synchronized void setContext(final Context context)
{
this.context = context;
}
- public String getVersion()
+ public synchronized String getVersion()
{
checkInitialised();
+
return server.getMessagingServerControl().getVersion();
}
public synchronized boolean createQueue(final String queueName, final String jndiBinding) throws Exception
{
checkInitialised();
- JBossQueue jBossQueue = new JBossQueue(queueName);
- server.getMessagingServerControl().createQueue(jBossQueue.getAddress(), jBossQueue.getAddress());
+ JBossQueue jBossQueue = new JBossQueue(queueName);
+ server.getMessagingServerControl().deployQueue(jBossQueue.getAddress(), jBossQueue.getAddress());
boolean added = bindToJndi(jndiBinding, jBossQueue);
if (added)
{
addToDestinationBindings(queueName, jndiBinding);
}
- managementService.registerQueue(jBossQueue,
- jndiBinding);
+ jmsManagementService.registerQueue(jBossQueue, jndiBinding);
return added;
}
@@ -182,15 +211,20 @@
{
checkInitialised();
JBossTopic jBossTopic = new JBossTopic(topicName);
- //We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS checks when routing messages to a topic that
- //does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no subscriptions - core has no notion of a topic
- server.getMessagingServerControl().createQueue(jBossTopic.getAddress(), jBossTopic.getAddress(), REJECT_FILTER, true);
+ // We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
+ // checks when routing messages to a topic that
+ // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
+ // subscriptions - core has no notion of a topic
+ server.getMessagingServerControl().deployQueue(jBossTopic.getAddress(),
+ jBossTopic.getAddress(),
+ REJECT_FILTER,
+ true);
boolean added = bindToJndi(jndiBinding, jBossTopic);
if (added)
{
addToDestinationBindings(topicName, jndiBinding);
}
- managementService.registerTopic(jBossTopic, jndiBinding);
+ jmsManagementService.registerTopic(jBossTopic, jndiBinding);
return added;
}
@@ -218,7 +252,7 @@
undeployDestination(name);
destinations.remove(name);
- managementService.unregisterQueue(name);
+ jmsManagementService.unregisterQueue(name);
server.getMessagingServerControl().destroyQueue(JBossQueue.createAddressFromName(name).toString());
return true;
@@ -230,7 +264,7 @@
undeployDestination(name);
destinations.remove(name);
- managementService.unregisterTopic(name);
+ jmsManagementService.unregisterTopic(name);
server.getMessagingServerControl().destroyQueue(JBossTopic.createAddressFromName(name).toString());
return true;
@@ -422,7 +456,7 @@
connectionFactoryBindings.remove(name);
connectionFactories.remove(name);
- managementService.unregisterConnectionFactory(name);
+ jmsManagementService.unregisterConnectionFactory(name);
return true;
}
@@ -460,14 +494,14 @@
// Private -------------------------------------------------------
- private void checkInitialised()
+ private synchronized void checkInitialised()
{
- if (!server.isInitialised())
+ if (!active)
{
- throw new IllegalStateException("Cannot access JMS Server, core server is not yet initialised");
+ throw new IllegalStateException("Cannot access JMS Server, core server is not yet active");
}
}
-
+
private void bindConnectionFactory(final JBossConnectionFactory cf,
final String name,
final List<String> jndiBindings) throws Exception
@@ -483,7 +517,7 @@
connectionFactoryBindings.get(name).add(jndiBinding);
}
- managementService.registerConnectionFactory(name, cf, jndiBindings);
+ jmsManagementService.registerConnectionFactory(name, cf, jndiBindings);
}
private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/JMSManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/JMSManagementService.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/JMSManagementService.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -37,7 +37,7 @@
*/
public interface JMSManagementService
{
- void registerJMSServer(JMSServerManager server) throws Exception;
+ JMSServerControlMBean registerJMSServer(JMSServerManager server) throws Exception;
void unregisterJMSServer() throws Exception;
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -39,6 +39,7 @@
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.management.JMSManagementService;
+import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.jms.server.management.jmx.impl.ReplicationAwareConnectionFactoryControlWrapper;
import org.jboss.messaging.jms.server.management.jmx.impl.ReplicationAwareJMSQueueControlWrapper;
import org.jboss.messaging.jms.server.management.jmx.impl.ReplicationAwareJMSServerControlWrapper;
@@ -69,14 +70,16 @@
// JMSManagementRegistration implementation ----------------------
- public synchronized void registerJMSServer(final JMSServerManager server) throws Exception
+ public synchronized JMSServerControlMBean registerJMSServer(final JMSServerManager server) throws Exception
{
ObjectName objectName = ObjectNames.getJMSServerObjectName();
JMSServerControl control = new JMSServerControl(server);
+ JMSServerControlMBean replicatingProxy = new ReplicationAwareJMSServerControlWrapper(control,
+ managementService.getReplicationOperationInvoker());
managementService.registerInJMX(objectName,
- new ReplicationAwareJMSServerControlWrapper(control,
- managementService.getReplicationOperationInvoker()));
+ replicatingProxy);
managementService.registerInRegistry(ResourceNames.JMS_SERVER, control);
+ return replicatingProxy;
}
public synchronized void unregisterJMSServer() throws Exception
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -984,8 +984,6 @@
{
conn.close();
}
-
- destroyQueue("MyQueue2");
}
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/HeuristicXATest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -35,6 +35,7 @@
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ClientSessionFactory;
import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
@@ -53,14 +54,16 @@
*/
public class HeuristicXATest extends ServiceTestBase
{
-
// Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(HeuristicXATest.class);
+
final SimpleString ADDRESS = new SimpleString("ADDRESS");
// Attributes ----------------------------------------------------
- MBeanServer mbeanServer;
+ private MBeanServer mbeanServer;
// Static --------------------------------------------------------
@@ -73,10 +76,7 @@
Configuration configuration = createDefaultConfig();
configuration.setJMXManagementEnabled(true);
- MessagingServer server = createServer(false,
- configuration,
- mbeanServer,
- new HashMap<String, AddressSettings>());
+ MessagingServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
try
{
@@ -96,12 +96,12 @@
}
- public void testHerusticCommit() throws Exception
+ public void testHeuristicCommit() throws Exception
{
internalTest(true);
}
- public void testHerusticRollback() throws Exception
+ public void testHeuristicRollback() throws Exception
{
internalTest(false);
}
@@ -111,10 +111,7 @@
Configuration configuration = createDefaultConfig();
configuration.setJMXManagementEnabled(true);
- MessagingServer server = createServer(false,
- configuration,
- mbeanServer,
- new HashMap<String, AddressSettings>());
+ MessagingServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
try
{
server.start();
@@ -164,8 +161,7 @@
if (isCommit)
{
- assertEquals(1,
- ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+ assertEquals(1, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
session = sf.createSession(false, false, false);
@@ -180,8 +176,7 @@
session.close();
}
- assertEquals(0,
- ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
+ assertEquals(0, ((Queue)server.getPostOffice().getBinding(ADDRESS).getBindable()).getMessageCount());
}
finally
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/SimpleAutomaticFailoverTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -47,6 +47,7 @@
import org.jboss.messaging.core.remoting.impl.invm.InVMConnector;
import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.jms.client.JBossTextMessage;
@@ -815,6 +816,105 @@
}
+ /*
+ * When a real connection fails due to the server actually dying, the backup server will receive
+ * a connection exception on the server side, since the live server has died taking the replicating
+ * connection with it.
+ * We cannot just fail the connection on the server side when this happens since this will cause the session
+ * on the backup to be closed, so clients won't be able to re-attach.
+ * This test verifies that server session is not closed on server side connection failure.
+ */
+ public void testFailoverFailBothOnClientAndServerSide() throws Exception
+ {
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
+ new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory",
+ backupParams));
+
+ sf.setProducerWindowSize(32 * 1024);
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ session.createQueue(ADDRESS, ADDRESS, null, false);
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ final int numMessages = 1000;
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session.createClientMessage(JBossTextMessage.TYPE,
+ false,
+ 0,
+ System.currentTimeMillis(),
+ (byte)1);
+ message.putIntProperty(new SimpleString("count"), i);
+ message.getBody().writeString("aardvarks");
+ producer.send(message);
+ }
+
+ RemotingConnection conn1 = ((ClientSessionImpl)session).getConnection();
+
+ // Simulate failure on connection
+ // We fail on the replicating connection and the client connection
+
+ MessagingException me = new MessagingException(MessagingException.NOT_CONNECTED);
+
+ //Note we call the remoting service impl handler which is what would happen in event
+ //of real connection failure
+
+ RemotingConnection serverSideReplicatingConnection = backupService.getRemotingService()
+ .getServerSideReplicatingConnection();
+
+
+ ((ConnectionLifeCycleListener)backupService.getRemotingService()).connectionException(serverSideReplicatingConnection.getID(), me);
+
+ conn1.fail(new MessagingException(MessagingException.NOT_CONNECTED));
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ session.start();
+
+ for (int i = 0; i < numMessages / 2; i++)
+ {
+ ClientMessage message2 = consumer.receive();
+
+ assertEquals("aardvarks", message2.getBody().readString());
+
+ assertEquals(i, message2.getProperty(new SimpleString("count")));
+
+ message2.acknowledge();
+ }
+
+ session.close();
+
+ session = sf.createSession(false, true, true);
+
+ consumer = session.createConsumer(ADDRESS);
+
+ session.start();
+
+ for (int i = numMessages / 2; i < numMessages; i++)
+ {
+ ClientMessage message2 = consumer.receive();
+
+ assertEquals("aardvarks", message2.getBody().readString());
+
+ assertEquals(i, message2.getProperty(new SimpleString("count")));
+
+ message2.acknowledge();
+ }
+
+ ClientMessage message3 = consumer.receive(250);
+
+ session.close();
+
+ assertNull(message3);
+
+ assertEquals(0, sf.numSessions());
+
+ assertEquals(0, sf.numConnections());
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -34,7 +34,6 @@
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
@@ -94,6 +93,13 @@
{
super.setUp();
+ doSetup(true);
+ }
+
+ protected void doSetup(boolean startServers) throws Exception
+ {
+ super.setUp();
+
backupMBeanServer = MBeanServerFactory.createMBeanServer();
liveMBeanServer = MBeanServerFactory.createMBeanServer();
@@ -107,7 +113,10 @@
backupConf.setBackup(true);
backupConf.setJMXManagementEnabled(true);
backupServer = Messaging.newMessagingServer(backupConf, backupMBeanServer, false);
- backupServer.start();
+ if (startServers)
+ {
+ backupServer.start();
+ }
Configuration liveConf = new ConfigurationImpl();
liveConf.setSecurityEnabled(false);
@@ -121,8 +130,13 @@
liveConf.setBackupConnectorName(backupTC.getName());
liveConf.setJMXManagementEnabled(true);
liveServer = Messaging.newMessagingServer(liveConf, liveMBeanServer, false);
- liveServer.start();
+ if (startServers)
+ {
+ liveServer.start();
+ }
}
+
+
@Override
protected void tearDown() throws Exception
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/BridgeTestBase.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -130,12 +130,12 @@
conf0.getAcceptorConfigurations()
.add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
server0 = Messaging.newMessagingServer(conf0, false);
- server0.start();
context0 = new InVMContext();
jmsServer0 = new JMSServerManagerImpl(server0);
+ jmsServer0.setContext(context0);
jmsServer0.start();
- jmsServer0.setContext(context0);
+
Configuration conf1 = new ConfigurationImpl();
conf1.setSecurityEnabled(false);
@@ -145,12 +145,12 @@
.add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory", params1));
server1 = Messaging.newMessagingServer(conf1, false);
- server1.start();
context1 = new InVMContext();
jmsServer1 = new JMSServerManagerImpl(server1);
+ jmsServer1.setContext(context1);
jmsServer1.start();
- jmsServer1.setContext(context1);
+
createQueue("sourceQueue", 0);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -98,7 +98,7 @@
public void testRetryConnectionOnStartup() throws Exception
{
- server1.stop();
+ jmsServer1.stop();
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory,
null, null, null, null,
@@ -114,7 +114,7 @@
assertTrue(bridge.isFailed());
//Restart the server
- server1.start();
+ jmsServer1.start();
context1 = new InVMContext();
jmsServer1 = new JMSServerManagerImpl(server1);
@@ -177,7 +177,7 @@
log.info("About to crash server");
- server1.stop();
+ jmsServer1.stop();
//Wait a while before starting up to simulate the dest being down for a while
log.info("Waiting 5 secs before bringing server back up");
@@ -188,13 +188,15 @@
log.info("Restarting server");
- server1.start();
+ jmsServer1.start();
- context1 = new InVMContext();
- jmsServer1 = new JMSServerManagerImpl(server1);
- jmsServer1.start();
- jmsServer1.setContext(context1);
+// context1 = new InVMContext();
+// jmsServer1 = new JMSServerManagerImpl(server1);
+// jmsServer1.start();
+// jmsServer1.setContext(context1);
+ jmsServer1.createQueue("targetQueue", "queue/targetQueue");
+
createQueue("targetQueue", 1);
setUpAdministeredObjects();
@@ -262,7 +264,7 @@
log.info("About to crash server");
- server1.stop();
+ jmsServer1.stop();
//Wait a while before starting up to simulate the dest being down for a while
log.info("Waiting 5 secs before bringing server back up");
@@ -270,7 +272,7 @@
log.info("Done wait");
//Restart the server
- server1.start();
+ jmsServer1.start();
context1 = new InVMContext();
jmsServer1 = new JMSServerManagerImpl(server1);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -32,7 +32,6 @@
import javax.jms.Session;
import javax.jms.TextMessage;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
@@ -309,16 +308,17 @@
@Override
protected void setUp() throws Exception
{
- super.setUp();
+ doSetup(false);
liveServerManager = new JMSServerManagerImpl(liveServer);
+ liveServerManager.setContext(new NullInitialContext());
liveServerManager.start();
- liveServerManager.setContext(new NullInitialContext());
+
backupServerManager = new JMSServerManagerImpl(backupServer);
+ backupServerManager.setContext(new NullInitialContext());
backupServerManager.start();
- backupServerManager.setContext(new NullInitialContext());
-
+
String queueName = randomString();
liveServerManager.createQueue(queueName, queueName);
backupServerManager.createQueue(queueName, queueName);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/connection/ExceptionListenerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/connection/ExceptionListenerTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/connection/ExceptionListenerTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -35,17 +35,14 @@
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_WINDOW_SIZE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
-import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_WINDOW_SIZE;
import javax.jms.Connection;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
import javax.jms.Session;
import org.jboss.messaging.core.client.impl.ClientSessionInternal;
@@ -55,15 +52,12 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.client.JBossConnection;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.client.JBossSession;
import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
import org.jboss.messaging.tests.integration.jms.server.management.NullInitialContext;
import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.utils.SimpleString;
/**
*
@@ -83,8 +77,6 @@
private static final String Q_NAME = "ConnectionTestQueue";
- private JBossQueue jBossQueue;
-
@Override
protected void setUp() throws Exception
{
@@ -96,10 +88,9 @@
conf.getAcceptorConfigurations()
.add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
server = Messaging.newMessagingServer(conf, false);
- server.start();
jmsServer = new JMSServerManagerImpl(server);
- jmsServer.start();
jmsServer.setContext(new NullInitialContext());
+ jmsServer.start();
jmsServer.createQueue(Q_NAME, Q_NAME);
cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/consumer/ConsumerTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -85,11 +85,10 @@
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations()
.add(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory"));
- server = Messaging.newMessagingServer(conf, false);
- server.start();
+ server = Messaging.newMessagingServer(conf, false);
jmsServer = new JMSServerManagerImpl(server);
- jmsServer.start();
jmsServer.setContext(new NullInitialContext());
+ jmsServer.start();
jmsServer.createQueue(Q_NAME, Q_NAME);
cf = new JBossConnectionFactory(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"),
null,
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -23,6 +23,7 @@
package org.jboss.messaging.tests.integration.jms.server;
import java.net.URL;
+import java.util.List;
import javax.jms.Queue;
import javax.jms.Topic;
@@ -30,15 +31,15 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
+import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.impl.JMSServerDeployer;
-import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
import org.jboss.messaging.tests.unit.util.InVMContext;
import org.jboss.messaging.tests.util.ServiceTestBase;
+import org.jboss.messaging.utils.Pair;
import org.w3c.dom.Element;
/**
@@ -59,19 +60,21 @@
// Constructors --------------------------------------------------
- private MessagingServer server;
-
private JMSServerManager jmsServer;
private Context context;
+
+ private DeploymentManager deploymentManager;
+
+ private Configuration config;
// Public --------------------------------------------------------
public void testValidateEmptyConfiguration() throws Exception
{
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer,
- server.getDeploymentManager(),
- server.getConfiguration());
+ deploymentManager,
+ config);
String xml = "<deployment xmlns='urn:jboss:messaging'> " + "</deployment>";
@@ -82,8 +85,8 @@
public void testDeployFullConfiguration() throws Exception
{
JMSServerDeployer deployer = new JMSServerDeployer(jmsServer,
- server.getDeploymentManager(),
- server.getConfiguration());
+ deploymentManager,
+ config);
String conf = "jbm-jms-for-JMSServerDeployerTest.xml";
URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
@@ -140,29 +143,200 @@
{
super.setUp();
- Configuration conf = new ConfigurationImpl();
- conf.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()));
- server = createServer(false, conf);
- server.start();
+ config = new ConfigurationImpl();
+
+ jmsServer = new DummyJMSServerManager();
- jmsServer = new JMSServerManagerImpl(server);
- jmsServer.start();
-
context = new InVMContext();
+
jmsServer.setContext(context);
}
- @Override
- protected void tearDown() throws Exception
- {
- jmsServer.stop();
- server.stop();
- super.tearDown();
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
+
+ class DummyJMSServerManager implements JMSServerManager
+ {
+ public boolean closeConnectionsForAddress(String ipAddress) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createConnectionFactory(String name,
+ DiscoveryGroupConfiguration discoveryGroupConfig,
+ long discoveryInitialWait,
+ String connectionLoadBalancingPolicyClassName,
+ long pingPeriod,
+ long connectionTTL,
+ long callTimeout,
+ String clientID,
+ int dupsOKBatchSize,
+ int transactionBatchSize,
+ int consumerWindowSize,
+ int consumerMaxRate,
+ int sendWindowSize,
+ int producerMaxRate,
+ int minLargeMessageSize,
+ boolean blockOnAcknowledge,
+ boolean blockOnNonPersistentSend,
+ boolean blockOnPersistentSend,
+ boolean autoGroup,
+ int maxConnections,
+ boolean preAcknowledge,
+ long retryInterval,
+ double retryIntervalMultiplier,
+ int reconnectAttempts,
+ boolean failoverOnNodeShutdown,
+ List<String> jndiBindings) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createConnectionFactory(String name,
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+ boolean blockOnAcknowledge,
+ boolean blockOnNonPersistentSend,
+ boolean blockOnPersistentSend,
+ boolean preAcknowledge,
+ List<String> bindings) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createConnectionFactory(String name,
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+ List<String> jndiBindings) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createConnectionFactory(String name,
+ List<Pair<TransportConfiguration, TransportConfiguration>> connectorConfigs,
+ String connectionLoadBalancingPolicyClassName,
+ long pingPeriod,
+ long connectionTTL,
+ long callTimeout,
+ String clientID,
+ int dupsOKBatchSize,
+ int transactionBatchSize,
+ int consumerWindowSize,
+ int consumerMaxRate,
+ int sendWindowSize,
+ int producerMaxRate,
+ int minLargeMessageSize,
+ boolean blockOnAcknowledge,
+ boolean blockOnNonPersistentSend,
+ boolean blockOnPersistentSend,
+ boolean autoGroup,
+ int maxConnections,
+ boolean preAcknowledge,
+ long retryInterval,
+ double retryIntervalMultiplier,
+ int reconnectAttempts,
+ boolean failoverOnNodeShutdown,
+ List<String> jndiBindings) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createQueue(String queueName, String jndiBinding) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean createTopic(String topicName, String jndiBinding) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean destroyConnectionFactory(String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean destroyQueue(String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean destroyTopic(String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String getVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isStarted()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String[] listConnectionIDs() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listRemoteAddresses() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listRemoteAddresses(String ipAddress) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listSessions(String connectionID) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setContext(Context context)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean undeployDestination(String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void start() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSQueueControlTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSQueueControlTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -697,6 +697,7 @@
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
+ serverManager.activated();
context = new InVMContext();
serverManager.setContext(context);
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControl2Test.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControl2Test.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControl2Test.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -83,8 +83,9 @@
context = new InVMContext();
JMSServerManagerImpl serverManager = new JMSServerManagerImpl(server);
+ serverManager.setContext(context);
serverManager.start();
- serverManager.setContext(context);
+ serverManager.activated();
return server;
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControlTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/JMSServerControlTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -428,13 +428,13 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
- server = Messaging.newMessagingServer(conf, mbeanServer, false);
- server.start();
+ server = Messaging.newMessagingServer(conf, mbeanServer, false);
context = new InVMContext();
- JMSServerManagerImpl serverManager = new JMSServerManagerImpl(server);
+ JMSServerManagerImpl serverManager = new JMSServerManagerImpl(server);
+ serverManager.setContext(context);
serverManager.start();
- serverManager.setContext(context);
+ serverManager.activated();
}
@Override
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/TopicControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/TopicControlTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/management/TopicControlTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -215,15 +215,15 @@
Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
JMSUtil.createDurableSubscriber(connection, topic, clientID, subscriptionName);
-
+
TopicControlMBean topicControl = createManagementControl();
assertEquals(1, topicControl.getDurableSubcriptionsCount());
+
+ connection.close();
topicControl.dropDurableSubscription(clientID, subscriptionName);
- assertEquals(0, topicControl.getDurableSubcriptionsCount());
-
- connection.close();
+ assertEquals(0, topicControl.getDurableSubcriptionsCount());
}
public void testDropDurableSubscriptionWithUnknownSubscription() throws Exception
@@ -357,6 +357,7 @@
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
serverManager.setContext(new NullInitialContext());
+ serverManager.activated();
clientID = randomString();
subscriptionName = randomString();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlUsingCoreTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -104,7 +104,17 @@
{
proxy.invokeOperation("createQueue", address, name, filter, durable);
}
+
+ public void deployQueue(String address, String name, String filter, boolean durable) throws Exception
+ {
+ proxy.invokeOperation("deployQueue", address, name, filter, durable);
+ }
+ public void deployQueue(String address, String name) throws Exception
+ {
+ proxy.invokeOperation("deployQueue", address, name);
+ }
+
public void destroyQueue(String name) throws Exception
{
proxy.invokeOperation("destroyQueue", name);
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -1,129 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, 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.messaging.tests.unit.core.config.impl;
-
-import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.config.cluster.QueueConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.deployers.impl.FileDeploymentManager;
-import org.jboss.messaging.core.deployers.impl.QueueDeployer;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * A QueueDeployerTest
- *
- * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
- *
- */
-public class QueueDeployerTest extends UnitTestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testParseQueueConfigurationFromAddressSettings() throws Exception
- {
- Configuration configuration = new ConfigurationImpl();
- QueueDeployer deployer = new QueueDeployer(new FileDeploymentManager(500), configuration);
-
- String xml = "<settings xmlns='urn:jboss:messaging'>"
- + " <queue name='foo'>"
- + " <address>bar</address>"
- + " <filter string='speed > 88' />"
- + " <durable>false</durable>"
- + " </queue>"
- + "</settings>";
-
- Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
- deployer.validate(rootNode);
- NodeList queueNodes = rootNode.getElementsByTagName("queue");
- assertEquals(1, queueNodes.getLength());
- deployer.deploy(queueNodes.item(0));
-
- assertEquals(1, configuration.getQueueConfigurations().size());
-
- QueueConfiguration queueConfiguration = configuration.getQueueConfigurations().get(0);
- assertEquals("foo", queueConfiguration.getName());
- assertEquals("bar", queueConfiguration.getAddress());
- assertEquals("speed > 88", queueConfiguration.getFilterString());
- assertEquals(false, queueConfiguration.isDurable());
- }
-
- public void testParseQueueConfigurationFromJBMConfiguration() throws Exception
- {
- Configuration configuration = new ConfigurationImpl();
- QueueDeployer deployer = new QueueDeployer(new FileDeploymentManager(500), configuration);
-
- String xml = "<deployment xmlns='urn:jboss:messaging'> "
- + "<configuration>"
- + "<acceptors>"
- + "<acceptor><factory-class>FooAcceptor</factory-class></acceptor>"
- + "</acceptors>"
- + "<queues>"
- + " <queue name='foo'>"
- + " <address>bar</address>"
- + " <filter string='speed > 88' />"
- + " <durable>false</durable>"
- + " </queue>"
- + "</queues>"
- + "</configuration>"
- + "<settings>"
- + " <queue name='foo2'>"
- + " <address>bar2</address>"
- + " <filter string='speed > 88' />"
- + " <durable>true</durable>"
- + " </queue>"
- + "</settings>"
- + "</deployment>";
-
- Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
- deployer.validate(rootNode);
- NodeList queueNodes = rootNode.getElementsByTagName("queue");
- assertEquals(2, queueNodes.getLength());
-
- deployer.deploy(queueNodes.item(0));
- deployer.deploy(queueNodes.item(1));
-
- assertEquals(2, configuration.getQueueConfigurations().size());
- assertEquals("foo", configuration.getQueueConfigurations().get(0).getName());
- assertEquals("foo2", configuration.getQueueConfigurations().get(1).getName());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueDeployerTest.java (from rev 6521, trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/QueueDeployerTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueDeployerTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueDeployerTest.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -0,0 +1,545 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, 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.messaging.tests.unit.core.deployers.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.cluster.QueueConfiguration;
+import org.jboss.messaging.core.deployers.DeploymentManager;
+import org.jboss.messaging.core.deployers.impl.QueueDeployer;
+import org.jboss.messaging.core.management.MessagingServerControlMBean;
+import org.jboss.messaging.tests.util.UnitTestCase;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * A QueueDeployerTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class QueueDeployerTest extends UnitTestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private FakeServerControl serverControl;
+
+ private QueueDeployer deployer;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testParseQueueConfigurationFromAddressSettings() throws Exception
+ {
+ String xml = "<settings xmlns='urn:jboss:messaging'>"
+ + " <queue name='foo'>"
+ + " <address>bar</address>"
+ + " <filter string='speed > 88' />"
+ + " <durable>false</durable>"
+ + " </queue>"
+ + "</settings>";
+
+ Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
+ deployer.validate(rootNode);
+ NodeList queueNodes = rootNode.getElementsByTagName("queue");
+ assertEquals(1, queueNodes.getLength());
+ deployer.deploy(queueNodes.item(0));
+
+ assertEquals(1, serverControl.configs.size());
+
+ QueueConfiguration queueConfiguration = serverControl.configs.get(0);
+ assertEquals("foo", queueConfiguration.getName());
+ assertEquals("bar", queueConfiguration.getAddress());
+ assertEquals("speed > 88", queueConfiguration.getFilterString());
+ assertEquals(false, queueConfiguration.isDurable());
+ }
+
+ public void testParseQueueConfigurationFromJBMConfiguration() throws Exception
+ {
+ String xml = "<deployment xmlns='urn:jboss:messaging'> "
+ + "<configuration>"
+ + "<acceptors>"
+ + "<acceptor><factory-class>FooAcceptor</factory-class></acceptor>"
+ + "</acceptors>"
+ + "<queues>"
+ + " <queue name='foo'>"
+ + " <address>bar</address>"
+ + " <filter string='speed > 88' />"
+ + " <durable>false</durable>"
+ + " </queue>"
+ + "</queues>"
+ + "</configuration>"
+ + "<settings>"
+ + " <queue name='foo2'>"
+ + " <address>bar2</address>"
+ + " <filter string='speed > 88' />"
+ + " <durable>true</durable>"
+ + " </queue>"
+ + "</settings>"
+ + "</deployment>";
+
+ Element rootNode = org.jboss.messaging.utils.XMLUtil.stringToElement(xml);
+ deployer.validate(rootNode);
+ NodeList queueNodes = rootNode.getElementsByTagName("queue");
+ assertEquals(2, queueNodes.getLength());
+
+ deployer.deploy(queueNodes.item(0));
+ deployer.deploy(queueNodes.item(1));
+
+ assertEquals(2, serverControl.configs.size());
+ assertEquals("foo", serverControl.configs.get(0).getName());
+ assertEquals("foo2", serverControl.configs.get(1).getName());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ DeploymentManager deploymentManager = new FakeDeploymentManager();
+ serverControl = new FakeServerControl();
+ deployer = new QueueDeployer(deploymentManager, serverControl);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ deployer = null;
+
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ private class FakeServerControl implements MessagingServerControlMBean
+ {
+
+ public boolean closeConnectionsForAddress(String ipAddress) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean commitPreparedTransaction(String transactionAsBase64) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void createQueue(String address, String name, String filter, boolean durable) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void createQueue(String address, String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ List<QueueConfiguration> configs = new ArrayList<QueueConfiguration>();
+
+ public void deployQueue(String address, String name, String filter, boolean durable) throws Exception
+ {
+ QueueConfiguration config = new QueueConfiguration(address, name, filter, durable);
+
+ configs.add(config);
+ }
+
+ public void deployQueue(String address, String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void destroyQueue(String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void disableMessageCounters() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void enableMessageCounters() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getBackupConnectorName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getBindingsDirectory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Configuration getConfiguration()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getConnectionCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getConnectionScanPeriod()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getConnectionTTLOverride()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public TabularData getConnectors() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getIDCacheSize()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public List<String> getInterceptorClassNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getJournalBufferReuseSize()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getJournalDirectory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getJournalFileSize()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getJournalMaxAIO()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getJournalMinFiles()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getJournalType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getLargeMessagesDirectory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getManagementAddress()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getManagementNotificationAddress()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public long getManagementRequestTimeout()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getMessageCounterMaxDayCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getMessageCounterSamplePeriod()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getMessageExpiryScanPeriod()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getMessageExpiryThreadPriority()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getPagingDirectory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getPagingGlobalWatermarkSize()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getPagingMaxGlobalSizeBytes()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getPagingMaxThreads()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getQueueActivationTimeout()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getScheduledThreadPoolMaxSize()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getSecurityInvalidationInterval()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getTransactionTimeout()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public long getTransactionTimeoutScanPeriod()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isBackup()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isClustered()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isCreateBindingsDir()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isCreateJournalDir()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isJournalSyncNonTransactional()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isJournalSyncTransactional()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isMessageCounterEnabled()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isPersistDeliveryCountBeforeDelivery()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isPersistIDCache()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isSecurityEnabled()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isStarted()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isWildcardRoutingEnabled()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String[] listConnectionIDs() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listPreparedTransactions() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listRemoteAddresses() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listRemoteAddresses(String ipAddress) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String[] listSessions(String connectionID) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void resetAllMessageCounterHistories() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void resetAllMessageCounters() throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean rollbackPreparedTransaction(String transactionAsBase64) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void sendQueueInfoToQueue(String queueName, String address) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMessageCounterMaxDayCount(int count) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setMessageCounterSamplePeriod(long newPeriod) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java 2009-04-23 15:41:03 UTC (rev 6541)
+++ trunk/tests/src/org/jboss/messaging/tests/util/ServiceTestBase.java 2009-04-23 17:16:28 UTC (rev 6542)
@@ -141,28 +141,28 @@
final Configuration configuration,
final Map<String, AddressSettings> settings)
{
- MessagingServer service;
+ MessagingServer server;
if (realFiles)
{
- service = Messaging.newMessagingServer(configuration);
+ server = Messaging.newMessagingServer(configuration);
}
else
{
- service = Messaging.newMessagingServer(configuration, false);
+ server = Messaging.newMessagingServer(configuration, false);
}
for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
{
- service.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+ server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
}
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
- service.getAddressSettingsRepository().addMatch("#", defaultSetting);
+ server.getAddressSettingsRepository().addMatch("#", defaultSetting);
- return service;
+ return server;
}
protected MessagingServer createServer(final boolean realFiles,
@@ -170,28 +170,28 @@
final MBeanServer mbeanServer,
final Map<String, AddressSettings> settings)
{
- MessagingServer service;
+ MessagingServer server;
if (realFiles)
{
- service = Messaging.newMessagingServer(configuration, mbeanServer);
+ server = Messaging.newMessagingServer(configuration, mbeanServer);
}
else
{
- service = Messaging.newMessagingServer(configuration, mbeanServer, false);
+ server = Messaging.newMessagingServer(configuration, mbeanServer, false);
}
for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
{
- service.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+ server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
}
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
- service.getAddressSettingsRepository().addMatch("#", defaultSetting);
+ server.getAddressSettingsRepository().addMatch("#", defaultSetting);
- return service;
+ return server;
}
protected MessagingServer createServer(final boolean realFiles)
@@ -207,30 +207,30 @@
protected MessagingServer createServer(final boolean realFiles, final Configuration configuration,
final JBMSecurityManager securityManager)
{
- MessagingServer service;
+ MessagingServer server;
if (realFiles)
{
- service = Messaging.newMessagingServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager);
+ server = Messaging.newMessagingServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager);
}
else
{
- service = Messaging.newMessagingServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, false);
+ server = Messaging.newMessagingServer(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager, false);
}
Map<String, AddressSettings> settings = new HashMap<String, AddressSettings>();
for (Map.Entry<String, AddressSettings> setting : settings.entrySet())
{
- service.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
+ server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
}
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(configuration.getPagingGlobalWatermarkSize());
- service.getAddressSettingsRepository().addMatch("#", defaultSetting);
+ server.getAddressSettingsRepository().addMatch("#", defaultSetting);
- return service;
+ return server;
}
protected MessagingServer createClusteredServerWithParams(final int index,
More information about the jboss-cvs-commits
mailing list