torquebox-messaging 1.1.1-java → 2.0.0.beta1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gem_hook.rb +26 -3
- data/lib/torquebox-messaging.jar +0 -0
- data/lib/torquebox-messaging.rb +2 -32
- data/lib/torquebox/messaging.rb +16 -0
- data/lib/torquebox/messaging/backgroundable.rb +32 -15
- data/lib/torquebox/messaging/backgroundable_processor.rb +32 -0
- data/lib/torquebox/messaging/connection.rb +127 -0
- data/lib/torquebox/messaging/connection_factory.rb +70 -0
- data/lib/torquebox/messaging/const_missing.rb +28 -0
- data/lib/torquebox/messaging/core.rb +27 -0
- data/lib/torquebox/messaging/destination.rb +68 -111
- data/lib/torquebox/messaging/ext/javax_jms_queue_browser.rb +1 -3
- data/lib/torquebox/messaging/future_responder.rb +10 -7
- data/lib/torquebox/messaging/json_message.rb +50 -0
- data/lib/torquebox/messaging/marshal_base64_message.rb +44 -0
- data/lib/torquebox/messaging/marshal_message.rb +43 -0
- data/lib/torquebox/messaging/message.rb +123 -0
- data/lib/torquebox/messaging/message_processor.rb +47 -0
- data/lib/torquebox/messaging/processor_wrapper.rb +38 -0
- data/lib/torquebox/messaging/queue.rb +61 -0
- data/lib/torquebox/messaging/session.rb +168 -0
- data/lib/torquebox/messaging/task.rb +7 -6
- data/lib/torquebox/messaging/text_message.rb +36 -0
- data/lib/torquebox/messaging/topic.rb +54 -0
- data/lib/torquebox/messaging/xa_connection.rb +58 -0
- data/lib/torquebox/messaging/xa_connection_factory.rb +59 -0
- data/lib/torquebox/messaging/xa_session.rb +30 -0
- data/licenses/lgpl-2.1.txt +7 -9
- data/spec/backgroundable_spec.rb +17 -24
- data/spec/destination_spec.rb +31 -318
- data/spec/future_responder_spec.rb +1 -1
- data/spec/json_message_spec.rb +50 -0
- data/spec/message_processor_spec.rb +54 -0
- data/spec/message_spec.rb +114 -0
- data/spec/task_spec.rb +11 -5
- metadata +38 -77
- data/lib/acl-spi-3.0.0.CR2.jar +0 -0
- data/lib/activation-1.1.jar +0 -0
- data/lib/authorization-spi-3.0.0.CR2.jar +0 -0
- data/lib/dtdparser-1.21.jar +0 -0
- data/lib/hornetq-core-2.1.2.Final.jar +0 -0
- data/lib/hornetq-jms-client-2.1.2.Final.jar +0 -0
- data/lib/hornetq-logging-2.1.2.Final.jar +0 -0
- data/lib/identity-spi-3.0.0.CR2.jar +0 -0
- data/lib/jaxb-api-2.1.9.jar +0 -0
- data/lib/jboss-common-core-2.2.17.GA.jar +0 -0
- data/lib/jboss-jms-api_1.1_spec-1.0.0.Final.jar +0 -0
- data/lib/jboss-logging-3.0.0.Beta4.jar +0 -0
- data/lib/jboss-reflect-2.2.0.GA.jar +0 -0
- data/lib/jbosssx-bare-3.0.0.CR2.jar +0 -0
- data/lib/jbossxacml-2.0.5.CR1.jar +0 -0
- data/lib/jbossxb-2.0.3.GA.jar +0 -0
- data/lib/jnp-client-5.0.5.Final.jar +0 -0
- data/lib/jruby-complete-1.6.3.jar +0 -0
- data/lib/netty-3.2.1.Final.jar +0 -0
- data/lib/picketbox-acl-impl-3.0.0.CR2.jar +0 -0
- data/lib/picketbox-bare-3.0.0.CR2.jar +0 -0
- data/lib/picketbox-identity-impl-3.0.0.CR2.jar +0 -0
- data/lib/picketbox-spi-bare-3.0.0.CR2.jar +0 -0
- data/lib/torquebox-base-core.jar +0 -0
- data/lib/torquebox-base-metadata.jar +0 -0
- data/lib/torquebox-base-spi.jar +0 -0
- data/lib/torquebox-mc-support.jar +0 -0
- data/lib/torquebox-messaging-core.jar +0 -0
- data/lib/torquebox/messaging/client.rb +0 -75
- data/lib/torquebox/messaging/ext/javax_jms_session.rb +0 -153
- data/lib/xercesImpl-2.9.1.jar +0 -0
- data/lib/xml-apis-1.3.04.jar +0 -0
- data/spec/client_spec.rb +0 -116
- data/spec/dispatcher-queues.yml +0 -4
- data/spec/dispatcher_not_running.rb +0 -54
- data/spec/ext/java_jmx_session_spec.rb +0 -71
- data/spec/queues.yml +0 -6
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright 2008-2011 Red Hat, Inc, and individual contributors.
|
2
|
+
#
|
3
|
+
# This is free software; you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU Lesser General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2.1 of
|
6
|
+
# the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This software is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this software; if not, write to the Free
|
15
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
+
|
18
|
+
require 'torquebox/messaging/core/connection_factory'
|
19
|
+
require 'torquebox/messaging/core/connection'
|
20
|
+
require 'torquebox/messaging/core/session'
|
21
|
+
require 'torquebox/messaging/core/message'
|
22
|
+
require 'torquebox/messaging/core/destination'
|
23
|
+
require 'torquebox/messaging/core/queue'
|
24
|
+
require 'torquebox/messaging/core/topic'
|
25
|
+
require 'torquebox/messaging/core/live_destination'
|
26
|
+
require 'torquebox/messaging/core/live_queue'
|
27
|
+
require 'torquebox/messaging/core/live_topic'
|
@@ -1,90 +1,80 @@
|
|
1
1
|
# Copyright 2008-2011 Red Hat, Inc, and individual contributors.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# This is free software; you can redistribute it and/or modify it
|
4
4
|
# under the terms of the GNU Lesser General Public License as
|
5
5
|
# published by the Free Software Foundation; either version 2.1 of
|
6
6
|
# the License, or (at your option) any later version.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# This software is distributed in the hope that it will be useful,
|
9
9
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
10
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
11
|
# Lesser General Public License for more details.
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# You should have received a copy of the GNU Lesser General Public
|
14
14
|
# License along with this software; if not, write to the Free
|
15
15
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
16
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
17
|
|
18
|
-
require 'torquebox/
|
19
|
-
require 'torquebox/messaging/
|
20
|
-
|
18
|
+
require 'torquebox/injectors'
|
19
|
+
require 'torquebox/messaging/session'
|
20
|
+
require 'torquebox/messaging/connection_factory'
|
21
21
|
require 'torquebox/messaging/ext/javax_jms_queue_browser'
|
22
22
|
|
23
23
|
module TorqueBox
|
24
24
|
module Messaging
|
25
|
-
|
26
|
-
|
25
|
+
class Destination
|
26
|
+
include TorqueBox::Injectors
|
27
27
|
include Enumerable
|
28
|
-
|
29
|
-
attr_reader :name
|
30
|
-
attr_reader :connect_options
|
31
|
-
attr_reader :enumerable_options
|
32
28
|
|
29
|
+
attr_reader :connection_factory
|
30
|
+
attr_reader :name
|
31
|
+
attr_accessor :enumerable_options
|
32
|
+
attr_accessor :connect_options
|
33
|
+
|
33
34
|
PRIORITY_MAP = {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
:low => 1,
|
36
|
+
:normal => 4,
|
37
|
+
:high => 7,
|
38
|
+
:critical => 9
|
38
39
|
}
|
39
40
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
@enumerable_options = enumerable_options || {}
|
41
|
+
def _dump(depth)
|
42
|
+
return self.name.queue_name if self.name.respond_to?( :queue_name )
|
43
|
+
self.name.to_s
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
48
|
-
Client.connect(@connect_options) do |session|
|
49
|
-
session.publish name, message, normalize_options(options)
|
50
|
-
session.commit if session.transacted?
|
51
|
-
end
|
52
|
-
}
|
46
|
+
def self._load(str)
|
47
|
+
self.new( str )
|
53
48
|
end
|
54
49
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
session.commit if session.transacted?
|
61
|
-
end
|
62
|
-
}
|
63
|
-
result
|
50
|
+
def initialize(destination, connection_factory = __inject__( 'connection-factory' ))
|
51
|
+
@name = destination
|
52
|
+
@connection_factory = ConnectionFactory.new( connection_factory )
|
53
|
+
@connect_options = {}
|
54
|
+
@enumerable_options = {}
|
64
55
|
end
|
65
56
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
57
|
+
def publish(message, options = {})
|
58
|
+
wait_for_destination(options[:startup_timeout]) do
|
59
|
+
with_session(options) do |session|
|
60
|
+
session.publish self, message, normalize_options(options)
|
61
|
+
end
|
71
62
|
end
|
72
63
|
end
|
73
|
-
alias_method :create, :start
|
74
64
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
65
|
+
def receive(options = {})
|
66
|
+
wait_for_destination(options[:startup_timeout]) do
|
67
|
+
with_session(options) do |session|
|
68
|
+
session.receive self, options
|
69
|
+
end
|
80
70
|
end
|
81
71
|
end
|
82
72
|
|
83
73
|
def each(&block)
|
84
74
|
wait_for_destination do
|
85
|
-
|
86
|
-
destination = session.
|
87
|
-
browser = session.create_browser( destination,
|
75
|
+
with_session do |session|
|
76
|
+
destination = session.java_destination( self )
|
77
|
+
browser = session.create_browser( destination, enumerable_options[:selector] )
|
88
78
|
begin
|
89
79
|
browser.each(&block)
|
90
80
|
ensure
|
@@ -94,92 +84,59 @@ module TorqueBox
|
|
94
84
|
end
|
95
85
|
end
|
96
86
|
|
97
|
-
def
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
def normalize_options(options)
|
104
|
-
if options.has_key?(:persistent)
|
105
|
-
options[:delivery_mode] =
|
106
|
-
options.delete(:persistent) ? javax.jms::DeliveryMode.PERSISTENT : javax.jms::DeliveryMode.NON_PERSISTENT
|
107
|
-
end
|
108
|
-
|
109
|
-
if options.has_key?(:priority)
|
110
|
-
if PRIORITY_MAP[options[:priority]]
|
111
|
-
options[:priority] = PRIORITY_MAP[options[:priority]]
|
112
|
-
elsif (0..9) === options[:priority].to_i
|
113
|
-
options[:priority] = options[:priority].to_i
|
114
|
-
else
|
115
|
-
raise ArgumentError.new(":priority must in the range 0..9, or one of #{PRIORITY_MAP.keys.collect {|k| ":#{k}"}.join(',')}")
|
87
|
+
def with_session(opts = {})
|
88
|
+
transactional = opts.fetch(:tx, true)
|
89
|
+
connection_factory.with_new_connection( connect_options[:client_id] ) do |connection|
|
90
|
+
connection.with_session(transactional) do |session|
|
91
|
+
yield session
|
116
92
|
end
|
117
93
|
end
|
118
|
-
|
119
|
-
options
|
120
94
|
end
|
121
95
|
|
122
96
|
def wait_for_destination(timeout=nil, &block)
|
123
|
-
timeout ||=
|
97
|
+
timeout ||= 30_000 # 30s default
|
124
98
|
start = Time.now
|
125
99
|
begin
|
126
100
|
block.call
|
127
|
-
rescue javax.naming.NameNotFoundException
|
101
|
+
rescue javax.naming.NameNotFoundException, javax.jms.JMSException
|
128
102
|
elapsed = (Time.now - start) * 1000
|
129
103
|
if elapsed > timeout
|
130
|
-
raise
|
104
|
+
raise
|
131
105
|
else
|
132
106
|
sleep(0.1)
|
133
107
|
retry
|
134
108
|
end
|
135
109
|
end
|
136
110
|
end
|
137
|
-
end
|
138
111
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
112
|
+
def normalize_options(options)
|
113
|
+
if options.has_key?(:persistent)
|
114
|
+
options[:delivery_mode] =
|
115
|
+
options.delete(:persistent) ? javax.jms::DeliveryMode.PERSISTENT : javax.jms::DeliveryMode.NON_PERSISTENT
|
116
|
+
end
|
144
117
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
118
|
+
if options.has_key?(:priority)
|
119
|
+
if PRIORITY_MAP[options[:priority]]
|
120
|
+
options[:priority] = PRIORITY_MAP[options[:priority]]
|
121
|
+
elsif (0..9) === options[:priority].to_i
|
122
|
+
options[:priority] = options[:priority].to_i
|
123
|
+
else
|
124
|
+
raise ArgumentError.new(":priority must in the range 0..9, or one of #{PRIORITY_MAP.keys.collect {|k| ":#{k}"}.join(',')}")
|
152
125
|
end
|
153
|
-
|
154
|
-
result
|
155
|
-
end
|
126
|
+
end
|
156
127
|
|
157
|
-
|
158
|
-
wait_for_destination(options[:startup_timeout]) {
|
159
|
-
Client.connect(@connect_options) do |session|
|
160
|
-
session.receive_and_publish(name, normalize_options(options), &block)
|
161
|
-
session.commit if session.transacted?
|
162
|
-
end
|
163
|
-
}
|
128
|
+
options
|
164
129
|
end
|
165
|
-
end
|
166
130
|
|
167
|
-
|
168
|
-
|
169
|
-
|
131
|
+
def enumerable_options
|
132
|
+
@enumerable_options ||= { }
|
133
|
+
@enumerable_options
|
134
|
+
end
|
170
135
|
|
171
|
-
def
|
172
|
-
|
136
|
+
def to_s
|
137
|
+
name
|
173
138
|
end
|
174
139
|
|
175
|
-
def unsubscribe(name = DEFAULT_SUBSCRIBER_NAME, options = {})
|
176
|
-
wait_for_destination(options[:startup_timeout]) {
|
177
|
-
Client.connect(@connect_options) do |session|
|
178
|
-
session.unsubscribe(name)
|
179
|
-
end
|
180
|
-
}
|
181
|
-
end
|
182
140
|
end
|
183
|
-
|
184
141
|
end
|
185
142
|
end
|
@@ -15,13 +15,11 @@
|
|
15
15
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
16
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
18
|
module javax.jms::QueueBrowser
|
21
19
|
include Enumerable
|
22
20
|
|
23
21
|
def each(&block)
|
24
|
-
enumeration.each(&block)
|
22
|
+
enumeration.map{ |m| TorqueBox::Messaging::Message.new(m) }.each(&block)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
@@ -71,8 +71,8 @@ module TorqueBox
|
|
71
71
|
self.result = yield
|
72
72
|
rescue Exception => e
|
73
73
|
self.error = e
|
74
|
-
puts "FutureResponder#respond: An error occured: ", e
|
75
|
-
puts e.backtrace.join( "\n" )
|
74
|
+
$stderr.puts "FutureResponder#respond: An error occured: ", e
|
75
|
+
$stderr.puts e.backtrace.join( "\n" )
|
76
76
|
end
|
77
77
|
|
78
78
|
# Convenience method that returns the thread local
|
@@ -95,11 +95,14 @@ module TorqueBox
|
|
95
95
|
message[:error] = @error if @error
|
96
96
|
message[:result] = @result if @result_set
|
97
97
|
@queue.publish( message,
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
:correlation_id => @correlation_id,
|
99
|
+
:ttl => @message_ttl,
|
100
|
+
:priority => priority,
|
101
|
+
:encoding => :marshal,
|
102
|
+
:tx => false # can't be a part of the task's tx!
|
103
|
+
)
|
104
|
+
rescue TypeError => ex
|
105
|
+
$stderr.puts "FutureResponder#send_response: Warning: unable to marshal #{@result.inspect}"
|
103
106
|
end
|
104
107
|
end
|
105
108
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Copyright 2008-2011 Red Hat, Inc, and individual contributors.
|
2
|
+
#
|
3
|
+
# This is free software; you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU Lesser General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2.1 of
|
6
|
+
# the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This software is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this software; if not, write to the Free
|
15
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
+
|
18
|
+
module TorqueBox
|
19
|
+
module Messaging
|
20
|
+
class JSONMessage < Message
|
21
|
+
ENCODING = :json
|
22
|
+
JMS_TYPE = :text
|
23
|
+
|
24
|
+
def require_json
|
25
|
+
# We can't ship our own json, as it may collide with the gem
|
26
|
+
# requirement for the app.
|
27
|
+
if !defined?( JSON )
|
28
|
+
begin
|
29
|
+
require 'json'
|
30
|
+
rescue LoadError => ex
|
31
|
+
raise RuntimeError.new( "Unable to load the json gem. Verify that is installed and in your Gemfile (if using Bundler)" )
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def encode(message)
|
37
|
+
require_json
|
38
|
+
@jms_message.text = JSON.fast_generate( message ) unless message.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def decode
|
42
|
+
require_json
|
43
|
+
JSON.parse( @jms_message.text, :symbolize_names => true ) unless @jms_message.text.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
Message.register_encoding( JSONMessage )
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright 2008-2011 Red Hat, Inc, and individual contributors.
|
2
|
+
#
|
3
|
+
# This is free software; you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU Lesser General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2.1 of
|
6
|
+
# the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This software is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this software; if not, write to the Free
|
15
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
+
|
18
|
+
require 'base64'
|
19
|
+
|
20
|
+
module TorqueBox
|
21
|
+
module Messaging
|
22
|
+
class MarshalBase64Message < Message
|
23
|
+
ENCODING = :marshal_base64
|
24
|
+
JMS_TYPE = :text
|
25
|
+
|
26
|
+
def encode(message)
|
27
|
+
unless message.nil?
|
28
|
+
marshalled = Marshal.dump( message )
|
29
|
+
@jms_message.text = Base64.encode64( marshalled )
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def decode
|
34
|
+
unless @jms_message.text.nil?
|
35
|
+
serialized = Base64.decode64( @jms_message.text )
|
36
|
+
Marshal.restore( serialized )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
Message.register_encoding( MarshalBase64Message )
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright 2008-2011 Red Hat, Inc, and individual contributors.
|
2
|
+
#
|
3
|
+
# This is free software; you can redistribute it and/or modify it
|
4
|
+
# under the terms of the GNU Lesser General Public License as
|
5
|
+
# published by the Free Software Foundation; either version 2.1 of
|
6
|
+
# the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This software is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this software; if not, write to the Free
|
15
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
+
|
18
|
+
module TorqueBox
|
19
|
+
module Messaging
|
20
|
+
class MarshalMessage < Message
|
21
|
+
ENCODING = :marshal
|
22
|
+
JMS_TYPE = :bytes
|
23
|
+
|
24
|
+
def encode(message)
|
25
|
+
unless message.nil?
|
26
|
+
marshalled = Marshal.dump( message )
|
27
|
+
@jms_message.write_bytes( marshalled.to_java_bytes )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def decode
|
32
|
+
if (length = @jms_message.get_body_length) > 0
|
33
|
+
bytes = Java::byte[length].new
|
34
|
+
@jms_message.read_bytes( bytes )
|
35
|
+
Marshal.restore( String.from_java_bytes( bytes ) )
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
Message.register_encoding( MarshalMessage )
|
42
|
+
end
|
43
|
+
end
|