org.torquebox.torquebox-messaging-container 1.0.0.Beta22-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ dev_lib_dir = File.dirname(__FILE__) + '/../target/org.torquebox.torquebox-naming-container/lib/'
4
+
5
+ require 'rubygems'
6
+
7
+ if ( File.exist?( dev_lib_dir ) )
8
+ $:.unshift File.join( File.dirname(__FILE__), '..', 'lib' )
9
+ Dir[ "#{dev_lib_dir}/*.jar" ].each do |jar|
10
+ require jar
11
+ end
12
+ else
13
+ require 'org.torquebox.torquebox-messaging-container'
14
+ end
15
+
16
+ require 'org.torquebox.torquebox-naming-container'
17
+ require 'torquebox/messaging/commands/message_broker'
18
+
19
+ command = TorqueBox::Messaging::Commands::MessageBroker.new
20
+ command.parse!( ARGV )
21
+
22
+ command.run()
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env jruby
2
+
3
+
4
+ dev_lib_dir = File.dirname(__FILE__) + '/../target/org.torquebox.torquebox-naming-container/lib/'
5
+
6
+ require 'rubygems'
7
+
8
+ if ( File.exist?( dev_lib_dir ) )
9
+ $:.unshift File.join( File.dirname(__FILE__), '..', 'lib' )
10
+ Dir[ "#{dev_lib_dir}/*.jar" ].each do |jar|
11
+ require jar
12
+ end
13
+ else
14
+ require 'org.torquebox.torquebox-messaging-container'
15
+ end
16
+
17
+ require 'org.torquebox.torquebox-container-foundation'
18
+ require 'torquebox/messaging/commands/message_processor_host'
19
+
20
+ command = TorqueBox::Messaging::Commands::MessageProcessorHost.new
21
+ command.parse!( ARGV )
22
+
23
+ command.run()
data/lib/gem_hook.rb ADDED
@@ -0,0 +1 @@
1
+ require 'torquebox/messaging/message_broker'
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,23 @@
1
+ module TorqueboxMessagingContainer
2
+ VERSION = '1.0.0.Beta22'
3
+ MAVEN_VERSION = '1.0.0.Beta22'
4
+ end
5
+ begin
6
+ require 'java'
7
+ require File.dirname(__FILE__) + '/torquebox-messaging-container.jar'
8
+ require File.dirname(__FILE__) + '/jboss-common-core-2.2.17.GA.jar'
9
+ require File.dirname(__FILE__) + '/jnp-client-5.0.5.Final.jar'
10
+ require File.dirname(__FILE__) + '/torquebox-messaging-int.jar'
11
+ require File.dirname(__FILE__) + '/torquebox-messaging-core.jar'
12
+ require File.dirname(__FILE__) + '/torquebox-messaging-metadata.jar'
13
+ require File.dirname(__FILE__) + '/jboss-jms-api_1.1_spec-1.0.0.Beta1.jar'
14
+ require File.dirname(__FILE__) + '/hornetq-core-2.1.2.Final.jar'
15
+ require File.dirname(__FILE__) + '/hornetq-jms-2.1.2.Final.jar'
16
+ require File.dirname(__FILE__) + '/hornetq-logging-2.1.2.Final.jar'
17
+ require File.dirname(__FILE__) + '/netty-3.2.1.Final.jar'
18
+ rescue LoadError
19
+ puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
20
+ raise
21
+ end
22
+
23
+ load File.dirname(__FILE__) + '/gem_hook.rb' if File.exists?( File.dirname(__FILE__) + '/gem_hook.rb')
Binary file
Binary file
@@ -0,0 +1,79 @@
1
+
2
+ require 'optparse'
3
+
4
+ require 'torquebox/container/foundation'
5
+ require 'torquebox/container/foundation_command'
6
+ require 'torquebox/messaging/message_broker'
7
+ require 'torquebox/naming'
8
+ require 'torquebox/naming/naming_service'
9
+
10
+ module TorqueBox
11
+ module Messaging
12
+ module Commands
13
+
14
+ class MessageBroker < TorqueBox::Container::FoundationCommand
15
+
16
+ attr_accessor :deploy_files
17
+ def initialize()
18
+ super
19
+ @deploy_files = []
20
+ @deployments = []
21
+ @naming_service = nil
22
+ @standalone = false
23
+ @bind_address = nil
24
+ end
25
+
26
+ def configure(container)
27
+ if ( @standalone )
28
+ container.enable( TorqueBox::Naming::NamingService )
29
+ else
30
+ TorqueBox::Naming.configure do |config|
31
+ config.host = @naming_service
32
+ end
33
+ end
34
+ container.enable( TorqueBox::Messaging::MessageBroker )
35
+ end
36
+
37
+ def after_start(container)
38
+ require 'vfs'
39
+ @deploy_files.each do |file|
40
+ puts "deploying #{file}"
41
+ deployment = container.deploy( file )
42
+ unit = container.deployment_unit( deployment.name )
43
+ virtual_file = org.jboss.vfs::VFS.child( File.join( Dir.pwd, file ) )
44
+ unit.addAttachment( 'org.torquebox.messaging.metadata.QueueMetaData.altDD', virtual_file )
45
+ container.process_deployments(true)
46
+ puts "deployed #{file}"
47
+ puts "deployment #{deployment.inspect}"
48
+ #puts "queue is #{TorqueBox::Naming['/queues/foo']}"
49
+ @deployments << deployment
50
+ end
51
+ end
52
+
53
+ def before_stop(container)
54
+ @deployments.reverse.each do |deployment|
55
+ container.undeploy( deployment.name )
56
+ end
57
+ end
58
+
59
+ def parser_options(opts)
60
+ opts.on( '-d', '--deploy FILE', 'Deploy a destination descriptor' ) do |file|
61
+ @deploy_files << file
62
+ end
63
+ opts.on( '-n', '--naming HOST', 'External naming service connection' ) do |naming_service|
64
+ @naming_service = naming_service
65
+ end
66
+ opts.on( '-s', '--standalone', 'Run standalone (include naming)' ) do |host|
67
+ @standalone = true
68
+ end
69
+ opts.on( '-b', '--bind', 'Bind address' ) do |bind_address|
70
+ @bind_address = bind_address
71
+ end
72
+ super( opts )
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,66 @@
1
+
2
+ require 'optparse'
3
+
4
+ require 'torquebox/container/foundation'
5
+ require 'torquebox/container/foundation_command'
6
+ require 'torquebox/messaging/message_processor_host'
7
+ require 'torquebox/messaging/metadata_builder'
8
+ require 'torquebox/naming'
9
+
10
+ module TorqueBox
11
+ module Messaging
12
+ module Commands
13
+
14
+ class MessageProcessorHost < TorqueBox::Container::FoundationCommand
15
+
16
+ attr_accessor :deploy_files
17
+ def initialize()
18
+ super
19
+ @deploy_files = []
20
+ @deployments = []
21
+ @naming_service = nil
22
+ end
23
+
24
+ def configure(container)
25
+ TorqueBox::Naming.configure do |config|
26
+ config.host = @naming_service
27
+ end
28
+ container.enable( TorqueBox::Messaging::MessageProcessorHost )
29
+ end
30
+
31
+ def after_start(container)
32
+ @deploy_files.each do |file|
33
+ deployment = container.deploy( file )
34
+ unit = container.deployment_unit( deployment.name )
35
+ puts "unit is #{unit.inspect}"
36
+ builder = TorqueBox::Messaging::MetaData::Builder.new()
37
+ builder.evaluate_file( file )
38
+ builder.processors.each do |processor|
39
+ org.torquebox.mc::AttachmentUtils.multipleAttach( unit, processor, processor.name )
40
+ end
41
+ container.process_deployments(true)
42
+ @deployments << deployment
43
+ end
44
+ end
45
+
46
+ def before_stop(container)
47
+ @deployments.reverse.each do |deployment|
48
+ container.undeploy( deployment )
49
+ end
50
+ end
51
+
52
+ def parser_options(opts)
53
+ opts.on( '-d', '--deploy FILE', 'Deploy a message-processor configuration' ) do |file|
54
+ @deploy_files << file
55
+ end
56
+ opts.on( '-n', '--naming HOST', 'External naming service connection' ) do |naming_service|
57
+ @naming_service = naming_service
58
+ end
59
+ super( opts )
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,120 @@
1
+ <!--
2
+ ~ Copyright 2009 Red Hat, Inc.
3
+ ~ Red Hat licenses this file to you under the Apache License, version
4
+ ~ 2.0 (the "License"); you may not use this file except in compliance
5
+ ~ with the License. You may obtain a copy of the License at
6
+ ~ http://www.apache.org/licenses/LICENSE-2.0
7
+ ~ Unless required by applicable law or agreed to in writing, software
8
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
9
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ ~ implied. See the License for the specific language governing
11
+ ~ permissions and limitations under the License.
12
+ -->
13
+
14
+ <configuration xmlns="urn:hornetq"
15
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
17
+
18
+ <clustered>true</clustered>
19
+ <security-enabled>false</security-enabled>
20
+
21
+ <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>
22
+
23
+ <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>
24
+
25
+ <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>
26
+
27
+ <journal-min-files>10</journal-min-files>
28
+
29
+ <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>
30
+
31
+ <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>
32
+
33
+ <connectors>
34
+ <connector name="netty">
35
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
36
+ <param key="host" value="${jboss.bind.address:localhost}"/>
37
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
38
+ </connector>
39
+
40
+ <connector name="netty-throughput">
41
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
42
+ <param key="host" value="${jboss.bind.address:localhost}"/>
43
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
44
+ <param key="batch-delay" value="50"/>
45
+ </connector>
46
+
47
+ <connector name="in-vm">
48
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
49
+ <param key="server-id" value="${hornetq.server-id:0}"/>
50
+ </connector>
51
+
52
+ </connectors>
53
+
54
+ <acceptors>
55
+ <acceptor name="netty">
56
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
57
+ <param key="host" value="${jboss.bind.address:localhost}"/>
58
+ <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
59
+ </acceptor>
60
+
61
+ <acceptor name="netty-throughput">
62
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
63
+ <param key="host" value="${jboss.bind.address:localhost}"/>
64
+ <param key="port" value="${hornetq.remoting.netty.batch.port:5455}"/>
65
+ <param key="batch-delay" value="50"/>
66
+ </acceptor>
67
+
68
+ <acceptor name="in-vm">
69
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
70
+ <param key="server-id" value="0"/>
71
+ </acceptor>
72
+
73
+ </acceptors>
74
+
75
+ <broadcast-groups>
76
+ <broadcast-group name="bg-group1">
77
+ <group-address>231.7.7.7</group-address>
78
+ <group-port>9876</group-port>
79
+ <broadcast-period>5000</broadcast-period>
80
+ <connector-ref connector-name="netty"/>
81
+ </broadcast-group>
82
+ </broadcast-groups>
83
+
84
+ <discovery-groups>
85
+ <discovery-group name="dg-group1">
86
+ <group-address>231.7.7.7</group-address>
87
+ <group-port>9876</group-port>
88
+ <refresh-timeout>10000</refresh-timeout>
89
+ </discovery-group>
90
+ </discovery-groups>
91
+
92
+ <cluster-connections>
93
+ <cluster-connection name="my-cluster">
94
+ <address>jms</address>
95
+ <discovery-group-ref discovery-group-name="dg-group1"/>
96
+ </cluster-connection>
97
+ </cluster-connections>
98
+
99
+ <security-settings>
100
+ <security-setting match="#">
101
+ <permission type="createNonDurableQueue" roles="guest"/>
102
+ <permission type="deleteNonDurableQueue" roles="guest"/>
103
+ <permission type="consume" roles="guest"/>
104
+ <permission type="send" roles="guest"/>
105
+ </security-setting>
106
+ </security-settings>
107
+
108
+ <address-settings>
109
+ <!--default for catch all-->
110
+ <address-setting match="#">
111
+ <dead-letter-address>jms.queue.DLQ</dead-letter-address>
112
+ <expiry-address>jms.queue.ExpiryQueue</expiry-address>
113
+ <redelivery-delay>0</redelivery-delay>
114
+ <max-size-bytes>10485760</max-size-bytes>
115
+ <message-counter-history-day-limit>10</message-counter-history-day-limit>
116
+ <address-full-policy>BLOCK</address-full-policy>
117
+ </address-setting>
118
+ </address-settings>
119
+
120
+ </configuration>
@@ -0,0 +1,112 @@
1
+ <deployment xmlns="urn:jboss:bean-deployer:2.0">
2
+
3
+ <classloader><inject bean="JRubyClassLoader"/></classloader>
4
+
5
+ <!--
6
+ Naming/RMI-related
7
+ -->
8
+
9
+ <bean name="RMIClassProviderExecutor" class="java.util.concurrent.ThreadPoolExecutor">
10
+ <constructor factoryMethod="newFixedThreadPool" factoryClass="java.util.concurrent.Executors">
11
+ <parameter>2</parameter>
12
+ </constructor>
13
+ <stop method="shutdown"/>
14
+ </bean>
15
+
16
+ <bean name="RMIClassProvider" class="org.torquebox.containers.web.WebServer">
17
+ <property name="threadPool"><inject bean="RMIClassProviderExecutor"/></property>
18
+ <install method="setJavaRmiServerCodebase" state="Installed"/>
19
+ </bean>
20
+ <!--
21
+ HornetQ
22
+ -->
23
+
24
+ <!-- The core configuration -->
25
+ <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
26
+ <property name="configurationUrl">${torquebox.hornetq.configuration.url}</property>
27
+ </bean>
28
+
29
+ <!-- MBean server -->
30
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
31
+ <constructor factoryClass="java.lang.management.ManagementFactory"
32
+ factoryMethod="getPlatformMBeanServer"/>
33
+ </bean>
34
+
35
+ <!-- The security manager -->
36
+ <bean name="HornetQSecurityManager" class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
37
+ <start ignored="true"/>
38
+ <stop ignored="true"/>
39
+ </bean>
40
+
41
+ <!-- The core server -->
42
+ <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
43
+ <constructor>
44
+ <parameter>
45
+ <inject bean="Configuration"/>
46
+ </parameter>
47
+ <parameter>
48
+ <inject bean="MBeanServer"/>
49
+ </parameter>
50
+ <parameter>
51
+ <inject bean="HornetQSecurityManager"/>
52
+ </parameter>
53
+ </constructor>
54
+ <start ignored="true"/>
55
+ <stop ignored="true"/>
56
+ </bean>
57
+
58
+ <bean name="JMSConfiguration" class="org.hornetq.jms.server.config.impl.JMSConfigurationImpl">
59
+ <constructor>
60
+ <parameter>
61
+ <list>
62
+ <bean name="ConnectionFactoryConfiguration" class="org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl">
63
+ <constructor>
64
+ <parameter>ConnectionFactory</parameter>
65
+ <parameter>ConnectionFactory</parameter>
66
+ </constructor>
67
+ <property name="connectorNames">
68
+ <list>
69
+ <bean name="AnonPair" class="org.hornetq.api.core.Pair">
70
+ <constructor>
71
+ <parameter>netty</parameter>
72
+ <parameter><null/></parameter>
73
+ </constructor>
74
+ </bean>
75
+ </list>
76
+ </property>
77
+ </bean>
78
+ </list>
79
+ </parameter>
80
+ <parameter>
81
+ <list/>
82
+ </parameter>
83
+ <parameter>
84
+ <list/>
85
+ </parameter>
86
+ </constructor>
87
+ </bean>
88
+
89
+ <!-- The JMS server -->
90
+ <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
91
+ <constructor>
92
+ <parameter class="org.hornetq.core.server.HornetQServer">
93
+ <inject bean="HornetQServer"/>
94
+ </parameter>
95
+ <parameter class="org.hornetq.jms.server.config.JMSConfiguration">
96
+ <inject bean="JMSConfiguration"/>
97
+ </parameter>
98
+ </constructor>
99
+ <depends state="Started">RMIClassProvider</depends>
100
+ </bean>
101
+
102
+ <!--
103
+ TorqueBox
104
+ -->
105
+
106
+ <bean name="QueuesYamlParsingDeployer" class="org.torquebox.messaging.deployers.QueuesYamlParsingDeployer"/>
107
+ <bean name="TopicsYamlParsingDeployer" class="org.torquebox.messaging.deployers.TopicsYamlParsingDeployer"/>
108
+
109
+ <bean name="ManagedQueueDeployer" class="org.torquebox.messaging.deployers.ManagedQueueDeployer"/>
110
+ <bean name="ManagedTopicDeployer" class="org.torquebox.messaging.deployers.ManagedTopicDeployer"/>
111
+
112
+ </deployment>