Permalink
Browse files

Rough in hornetq configuration and launching to the messaging contain…

…er for ruby.

Wire up the contain builds to the core build.
  • Loading branch information...
1 parent 0adfc44 commit 33354078a351ff45a1ec0533c4dcb147c40caa73 Bob McWhirter committed May 24, 2010
@@ -19,11 +19,13 @@ def initialize()
end
def start
+ puts "STARTING Foundation"
@server.start
fundamental_deployment_paths.each do |path|
fundamental_deployments << deploy( path )
end
process_deployments( true )
+ puts "STARTED Foundation"
end
def stop
@@ -35,14 +37,11 @@ def stop
end
def deploy(path)
- puts "deploying #{path}"
virtual_file = Java::org.jboss.vfs::VFS.getChild( path )
- puts "deploying VFS: #{virtual_file}"
+ puts "DEPLOY VFS: #{virtual_file}"
deployment_factory = Java::org.jboss.deployers.vfs.spi.client::VFSDeploymentFactory.instance
deployment = deployment_factory.createVFSDeployment(virtual_file)
- puts "deployment #{deployment}"
main_deployer.addDeployment(deployment)
- puts "deployed #{deployment.name}"
deployment
end
@@ -51,7 +50,7 @@ def undeploy(deployment_name)
end
def process_deployments(check_complete=false)
- puts "processing deployments"
+ puts "PROCESS DEPLOYMENTS"
main_deployer.process
if ( check_complete )
puts "checking completeness"
@@ -0,0 +1,121 @@
+<!--
+ ~ Copyright 2009 Red Hat, Inc.
+ ~ Red Hat licenses this file to you under the Apache License, version
+ ~ 2.0 (the "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ ~ implied. See the License for the specific language governing
+ ~ permissions and limitations under the License.
+ -->
+
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <clustered>true</clustered>
+
+<!--
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
+-->
+
+ <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
+
+ <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
+
+ <journal-min-files>10</journal-min-files>
+
+ <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
+
+ <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
+
+ <connectors>
+ <connector name="netty">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </connector>
+
+ <connector name="netty-throughput">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
+ <param key="batch-delay" value="50"/>
+ </connector>
+
+ <connector name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+ <param key="server-id" value="${hornetq.server-id:0}"/>
+ </connector>
+
+ </connectors>
+
+ <acceptors>
+ <acceptor name="netty">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+ </acceptor>
+
+ <acceptor name="netty-throughput">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+ <param key="host" value="${jboss.bind.address:localhost}"/>
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
+ <param key="batch-delay" value="50"/>
+ </acceptor>
+
+ <acceptor name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+ <param key="server-id" value="0"/>
+ </acceptor>
+
+ </acceptors>
+
+ <broadcast-groups>
+ <broadcast-group name="bg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <broadcast-period>5000</broadcast-period>
+ <connector-ref connector-name="netty"/>
+ </broadcast-group>
+ </broadcast-groups>
+
+ <discovery-groups>
+ <discovery-group name="dg-group1">
+ <group-address>231.7.7.7</group-address>
+ <group-port>9876</group-port>
+ <refresh-timeout>10000</refresh-timeout>
+ </discovery-group>
+ </discovery-groups>
+
+ <cluster-connections>
+ <cluster-connection name="my-cluster">
+ <address>jms</address>
+ <discovery-group-ref discovery-group-name="dg-group1"/>
+ </cluster-connection>
+ </cluster-connections>
+
+ <security-settings>
+ <security-setting match="#">
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+ <address-settings>
+ <!--default for catch all-->
+ <address-setting match="#">
+ <dead-letter-address>jms.queue.DLQ</dead-letter-address>
+ <expiry-address>jms.queue.ExpiryQueue</expiry-address>
+ <redelivery-delay>0</redelivery-delay>
+ <max-size-bytes>10485760</max-size-bytes>
+ <message-counter-history-day-limit>10</message-counter-history-day-limit>
+ <address-full-policy>BLOCK</address-full-policy>
+ </address-setting>
+ </address-settings>
+
+</configuration>
@@ -1,8 +1,48 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ HornetQ
+ -->
+
+ <!-- The core configuration -->
+ <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
+ <property name="configurationUrl">${torquebox.hornetq.configuration.url}</property>
+ </bean>
+
+
+ <!-- The core server -->
+ <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="Configuration"/>
+ </parameter>
+ </constructor>
+ <start ignored="true"/>
+ <stop ignored="true"/>
+ </bean>
+
+ <!-- The JMS server -->
+ <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
+ <constructor>
+ <parameter>
+ <inject bean="HornetQServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!--
+ TorqueBox
+ -->
+
<bean name="QueuesYamlParsingDeployer" class="org.torquebox.messaging.deployers.QueuesYamlParsingDeployer"/>
<bean name="TopicsYamlParsingDeployer" class="org.torquebox.messaging.deployers.TopicsYamlParsingDeployer"/>
<bean name="ManagedQueueDeployer" class="org.torquebox.messaging.deployers.ManagedQueueDeployer"/>
<bean name="ManagedTopicDeployer" class="org.torquebox.messaging.deployers.ManagedTopicDeployer"/>
+
+ <bean name="MessagingRbParsingDeployer" class="org.torquebox.messaging.deployers.MessagingRbParsingDeployer"/>
+ <bean name="MessageProcessorDeployer" class="org.torquebox.messaging.deployers.MessageProcessorDeployer"/>
+
+ <bean name="MessagingRuntimePoolDeployer" class="org.torquebox.messaging.deployers.MessagingRuntimePoolDeployer"/>
</deployment>
@@ -11,6 +11,7 @@ def initialize()
def start
super
+ Java::java.lang.System.setProperty( "torquebox.hornetq.configuration.url", "file://" + File.join( File.dirname(__FILE__), 'hornetq-configuration.xml' ) )
beans_xml = File.join( File.dirname(__FILE__), 'messaging-jboss-beans.xml' )
puts "beans_xml=#{beans_xml}"
@core_deployers = deploy( beans_xml )
@@ -27,9 +27,36 @@
<groupId>org.torquebox</groupId>
<artifactId>torquebox-messaging-int</artifactId>
<version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-core</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jms</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.torquebox</groupId>
+ <artifactId>vfs</artifactId>
+ <version>${project.version}</version>
+ <type>gem</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>rubygems</groupId>
<artifactId>rspec</artifactId>
<type>gem</type>
@@ -3,6 +3,7 @@
describe TorqueBox::Container::Messaging do
+=begin
it "should be instantiable" do
container = TorqueBox::Container::Messaging.new
end
@@ -15,5 +16,17 @@
puts "stopping container #{container}"
container.stop
end
+=end
+
+
+ it "should be able to deploy a messaging.rb" do
+ container = TorqueBox::Container::Messaging.new
+ container.start
+ puts "started container #{container}"
+ container.deploy( File.join( File.dirname(__FILE__), 'messaging.rb' ) )
+ container.process_deployments( true )
+ puts "stopping container #{container}"
+ container.stop
+ end
end
@@ -0,0 +1,10 @@
+
+class MyConsumer
+ def process!(msg)
+ puts "processing #{msg.inspect}"
+ end
+end
+
+TorqueBox::Messaging::Gateway.define do |gateway|
+ gateway.subscribe MyConsumer, '/queues/foo'
+end
View
@@ -20,6 +20,7 @@
</build>
<modules>
+ <module>container-parent</module>
<module>foundation</module>
<module>messaging</module>
</modules>
View
@@ -24,6 +24,7 @@
<module>parent</module>
<module>build-support</module>
<module>components</module>
+ <module>containers</module>
<module>assemblage</module>
</modules>

0 comments on commit 3335407

Please sign in to comment.