ap4r 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/Rakefile +1 -1
- data/bin/ap4r_setup +1 -1
- data/config/ap4r_settings.rb +1 -1
- data/config/queues_disk.cfg +1 -1
- data/lib/ap4r.rb +2 -1
- data/lib/ap4r/script/base.rb +1 -1
- data/lib/ap4r/script/queue_manager_control.rb +1 -1
- data/lib/ap4r/script/setup.rb +4 -3
- data/lib/ap4r/script/workspace_generator.rb +1 -1
- data/lib/ap4r/store_and_forward.rb +3 -3
- data/lib/ap4r/stored_message.rb +5 -11
- data/lib/ap4r/util/irm.rb +6 -6
- data/lib/ap4r/util/queue_client.rb +1 -1
- data/lib/ap4r/version.rb +2 -2
- data/rails_plugin/ap4r/init.rb +3 -3
- data/rails_plugin/ap4r/lib/async_controller.rb +4 -4
- data/script/start +1 -1
- metadata +27 -25
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/bin/ap4r_setup
CHANGED
@@ -3,4 +3,4 @@ Signal.trap("INT") { puts; exit }
|
|
3
3
|
require File.dirname(__FILE__) + '/../lib/ap4r/script/setup'
|
4
4
|
|
5
5
|
require 'ap4r/script/workspace_generator'
|
6
|
-
|
6
|
+
Ap4r::Script::WorkspaceGenerator.new.run(ARGV, :generator => 'app')
|
data/config/ap4r_settings.rb
CHANGED
data/config/queues_disk.cfg
CHANGED
data/lib/ap4r.rb
CHANGED
data/lib/ap4r/script/base.rb
CHANGED
data/lib/ap4r/script/setup.rb
CHANGED
@@ -9,9 +9,10 @@ begin
|
|
9
9
|
require 'active_support'
|
10
10
|
rescue LoadError
|
11
11
|
require 'rubygems'
|
12
|
-
|
12
|
+
gem 'active_support'
|
13
|
+
require 'active_support'
|
13
14
|
end
|
14
15
|
|
15
16
|
require 'ap4r/script/base'
|
16
|
-
|
17
|
-
|
17
|
+
Ap4r::Script::Base.logger = Logger.new(STDOUT)
|
18
|
+
Ap4r::Script::Base.ap4r_base = File.join(File.dirname(__FILE__) , '../../../')
|
@@ -7,7 +7,7 @@ begin require 'rubygems'; rescue LoadError; end
|
|
7
7
|
require 'reliable-msg'
|
8
8
|
require 'ap4r/stored_message'
|
9
9
|
|
10
|
-
module
|
10
|
+
module Ap4r
|
11
11
|
|
12
12
|
# This +StoreAndForward+ provides at-least-once QoS level which
|
13
13
|
# guarantees not to lose any message.
|
@@ -86,7 +86,7 @@ if __FILE__ == $0
|
|
86
86
|
|
87
87
|
class TestSaf
|
88
88
|
|
89
|
-
include ::
|
89
|
+
include ::Ap4r::StoreAndForward
|
90
90
|
|
91
91
|
def connect
|
92
92
|
unless ActiveRecord::Base.connected?
|
@@ -101,7 +101,7 @@ if __FILE__ == $0
|
|
101
101
|
def async_dispatch_with_saf(queue_name, queue_message, rm_options = {})
|
102
102
|
|
103
103
|
connect()
|
104
|
-
stored_message_id = ::
|
104
|
+
stored_message_id = ::Ap4r::StoredMessage.store(queue_name, queue_message, rm_options)
|
105
105
|
forward_by_queue_info(
|
106
106
|
stored_message_id,
|
107
107
|
{
|
data/lib/ap4r/stored_message.rb
CHANGED
@@ -7,11 +7,13 @@ begin
|
|
7
7
|
require 'uuid'
|
8
8
|
rescue LoadError
|
9
9
|
require 'rubygems'
|
10
|
-
|
11
|
-
|
10
|
+
gem 'activerecord'
|
11
|
+
require 'activerecord'
|
12
|
+
gem 'uuid'
|
13
|
+
require 'uuid'
|
12
14
|
end
|
13
15
|
|
14
|
-
module
|
16
|
+
module Ap4r
|
15
17
|
|
16
18
|
# This class is the model class for SAF(store and foward).
|
17
19
|
# The migration file is located at following path,
|
@@ -26,14 +28,6 @@ module AP4R
|
|
26
28
|
PHYSICAL = :physical
|
27
29
|
LOGICAL = :logical
|
28
30
|
|
29
|
-
#--
|
30
|
-
# TODO: modify directory structure and be reloadable, 2006/10/17 kato-k
|
31
|
-
#++
|
32
|
-
# Temporarily, exclude this class from auto-reload targets of rails.
|
33
|
-
def self.reloadable?
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
31
|
# Insert queue information, such as queue name and message, for next logic.
|
38
32
|
#
|
39
33
|
# duplication_check_id is generated from UUID and should be unique
|
data/lib/ap4r/util/irm.rb
CHANGED
@@ -9,7 +9,7 @@ require 'rubygems'
|
|
9
9
|
require 'ap4r'
|
10
10
|
require 'ap4r/util/queue_client'
|
11
11
|
|
12
|
-
class
|
12
|
+
class Ap4r::Configuration #:nodoc:
|
13
13
|
SETTINGS_FILES_DEFAULT = %w( config/ap4r_settings.rb )
|
14
14
|
|
15
15
|
class Services #:nodoc:
|
@@ -21,7 +21,7 @@ class AP4R::Configuration #:nodoc:
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def add(*args)
|
24
|
-
client =
|
24
|
+
client = Ap4r::Util::QueueClient.new(*args)
|
25
25
|
@list << (client)
|
26
26
|
end
|
27
27
|
|
@@ -55,7 +55,7 @@ class IRM
|
|
55
55
|
class << self
|
56
56
|
def [](name)
|
57
57
|
sym_name = name.to_sym
|
58
|
-
|
58
|
+
Ap4r::Configuration.services.find{|service| service.name == sym_name }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -63,16 +63,16 @@ end
|
|
63
63
|
#--
|
64
64
|
|
65
65
|
def each(&block)
|
66
|
-
|
66
|
+
Ap4r::Configuration.services.each(&block)
|
67
67
|
end
|
68
68
|
extend Enumerable
|
69
69
|
|
70
|
-
|
70
|
+
Ap4r::Configuration.load_setting_files
|
71
71
|
|
72
72
|
$original_main = self
|
73
73
|
|
74
74
|
class Object
|
75
|
-
|
75
|
+
Ap4r::Configuration.services.each {|s|
|
76
76
|
module_eval <<-EOS
|
77
77
|
def #{s.name.to_s}
|
78
78
|
irb_change_workspace(IRM[:#{s.name.to_s}])
|
data/lib/ap4r/version.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
# Copyright:: Copyright (c) 2006 Future System Consulting Corp.
|
3
3
|
# Licence:: MIT Licence
|
4
4
|
|
5
|
-
module
|
5
|
+
module Ap4r
|
6
6
|
# Defines version number contants, and provides
|
7
7
|
# its string expression.
|
8
8
|
module VERSION #:nodoc:
|
9
9
|
MAJOR = 0
|
10
|
-
MINOR =
|
10
|
+
MINOR = 3
|
11
11
|
TINY = 0
|
12
12
|
|
13
13
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
data/rails_plugin/ap4r/init.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
# Copyright:: Copyright (c) 2006 Future System Consulting Corp.
|
3
3
|
# Licence:: MIT Licence
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
require 'async_controller'
|
6
|
+
require 'ap4r/stored_message'
|
7
7
|
|
8
8
|
class ActionController::Base
|
9
|
-
include
|
9
|
+
include Ap4r::AsyncController::Base
|
10
10
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'reliable-msg'
|
6
6
|
#require 'ap4r/stored_message'
|
7
7
|
|
8
|
-
module
|
8
|
+
module Ap4r
|
9
9
|
# This +asyncController+ is the Rails plugin for asynchronous processing.
|
10
10
|
# Asynchronous logics are called via various protocols, such as XML-RPC,
|
11
11
|
# SOAP, HTTP PUT, and more. Now implemented jsut as XML-RPC.
|
@@ -81,7 +81,7 @@ module AP4R
|
|
81
81
|
StoredMessage.transaction do
|
82
82
|
options = {:delete_mode => @delete_mode || :physical}
|
83
83
|
forwarded_messages.keys.each {|id|
|
84
|
-
::
|
84
|
+
::Ap4r::StoredMessage.destroy_if_exists(id, options)
|
85
85
|
}
|
86
86
|
end
|
87
87
|
rescue Exception => err
|
@@ -140,7 +140,7 @@ module AP4R
|
|
140
140
|
queue_headers = converter.make_rm_options
|
141
141
|
|
142
142
|
if Thread.current[:use_saf]
|
143
|
-
stored_message = ::
|
143
|
+
stored_message = ::Ap4r::StoredMessage.store(queue_name, queue_message, queue_headers)
|
144
144
|
|
145
145
|
Thread.current[:stored_messages].store(
|
146
146
|
stored_message.id,
|
@@ -181,7 +181,7 @@ module AP4R
|
|
181
181
|
# add self to a Converters list.
|
182
182
|
def self.dispatch_mode(mode_symbol)
|
183
183
|
self.const_set(:DISPATCH_MODE, mode_symbol)
|
184
|
-
::
|
184
|
+
::Ap4r::AsyncController::Base::Converters[mode_symbol] = self
|
185
185
|
end
|
186
186
|
|
187
187
|
def initialize(controller, async_params, options, rm_options)
|
data/script/start
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: ap4r
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2007-04-06 00:00:00 +09:00
|
8
8
|
summary: Asynchronous Processing for Ruby.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -25,54 +25,56 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
+
post_install_message:
|
28
29
|
authors:
|
29
30
|
- Shunichi Shinohara
|
30
31
|
- Kiwamu Kato
|
31
32
|
files:
|
32
|
-
- CHANGELOG
|
33
|
-
- Rakefile
|
34
33
|
- bin
|
35
|
-
-
|
34
|
+
- CHANGELOG
|
35
|
+
- config
|
36
|
+
- doc
|
36
37
|
- lib
|
37
38
|
- MIT-LICENSE
|
38
|
-
- config
|
39
|
-
- script
|
40
39
|
- rails_plugin
|
40
|
+
- Rakefile
|
41
|
+
- README
|
42
|
+
- script
|
41
43
|
- bin/ap4r_setup
|
42
|
-
- config/queues_disk.cfg
|
43
|
-
- config/queues_mysql.cfg
|
44
|
-
- config/log4r.yaml
|
45
44
|
- config/ap4r_settings.rb
|
45
|
+
- config/log4r.yaml
|
46
46
|
- config/queues.cfg
|
47
|
+
- config/queues_disk.cfg
|
48
|
+
- config/queues_mysql.cfg
|
47
49
|
- rails_plugin/ap4r
|
48
50
|
- rails_plugin/ap4r/init.rb
|
49
51
|
- rails_plugin/ap4r/lib
|
50
52
|
- rails_plugin/ap4r/lib/async_controller.rb
|
51
53
|
- script/irm
|
52
|
-
- script/
|
54
|
+
- script/loop.cmd
|
53
55
|
- script/loop.rb
|
54
56
|
- script/start
|
55
|
-
- script/
|
56
|
-
- lib/ap4r.rb
|
57
|
+
- script/stop
|
57
58
|
- lib/ap4r
|
59
|
+
- lib/ap4r/message_store_ext.rb
|
60
|
+
- lib/ap4r/multi_queue.rb
|
58
61
|
- lib/ap4r/queue_manager_ext.rb
|
59
62
|
- lib/ap4r/queue_manager_ext_debug.rb
|
60
|
-
- lib/ap4r/stored_message.rb
|
61
|
-
- lib/ap4r/store_and_forward.rb
|
62
63
|
- lib/ap4r/retention_history.rb
|
63
|
-
- lib/ap4r/util
|
64
|
-
- lib/ap4r/start_with_log4r.rb
|
65
|
-
- lib/ap4r/multi_queue.rb
|
66
|
-
- lib/ap4r/message_store_ext.rb
|
67
64
|
- lib/ap4r/script
|
68
|
-
- lib/ap4r/version.rb
|
69
|
-
- lib/ap4r/util/loc.rb
|
70
|
-
- lib/ap4r/util/queue_client.rb
|
71
|
-
- lib/ap4r/util/irm.rb
|
72
65
|
- lib/ap4r/script/base.rb
|
73
|
-
- lib/ap4r/script/workspace_generator.rb
|
74
66
|
- lib/ap4r/script/queue_manager_control.rb
|
75
67
|
- lib/ap4r/script/setup.rb
|
68
|
+
- lib/ap4r/script/workspace_generator.rb
|
69
|
+
- lib/ap4r/start_with_log4r.rb
|
70
|
+
- lib/ap4r/store_and_forward.rb
|
71
|
+
- lib/ap4r/stored_message.rb
|
72
|
+
- lib/ap4r/util
|
73
|
+
- lib/ap4r/util/irm.rb
|
74
|
+
- lib/ap4r/util/loc.rb
|
75
|
+
- lib/ap4r/util/queue_client.rb
|
76
|
+
- lib/ap4r/version.rb
|
77
|
+
- lib/ap4r.rb
|
76
78
|
test_files: []
|
77
79
|
|
78
80
|
rdoc_options:
|