rservicebus2 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/return_messages_to_source_queue +3 -3
- data/bin/rsb_ctl +1 -1
- data/bin/rservicebus2 +3 -3
- data/bin/rservicebus2-transport +4 -5
- data/bin/send_empty_message +6 -7
- data/lib/rservicebus2.rb +59 -0
- data/lib/{rservicebus → rservicebus2}/agent.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/appresource.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/appresource/dir.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/appresource/file.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/appresource/fluiddb.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/appresource_configure.rb +4 -4
- data/lib/{rservicebus → rservicebus2}/audit.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/circuitbreaker.rb +5 -5
- data/lib/{rservicebus → rservicebus2}/config.rb +1 -2
- data/lib/{rservicebus → rservicebus2}/cron_manager.rb +4 -4
- data/lib/{rservicebus → rservicebus2}/endpointmapping.rb +4 -4
- data/lib/{rservicebus → rservicebus2}/errormessage.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/handler_loader.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/handler_manager.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/helper_functions.rb +4 -4
- data/lib/{rservicebus → rservicebus2}/host.rb +4 -4
- data/lib/{rservicebus → rservicebus2}/message.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/message/statisticoutput.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/message/subscription.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/message/verboseoutput.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/monitor.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/monitor/csvdir.rb +7 -7
- data/lib/{rservicebus → rservicebus2}/monitor/dir.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/monitor/dirnotifier.rb +11 -11
- data/lib/{rservicebus → rservicebus2}/monitor/message.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/monitor/xmldir.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/monitor_configure.rb +7 -7
- data/lib/{rservicebus → rservicebus2}/mq.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/mq/beanstalk.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/resource_manager.rb +7 -7
- data/lib/{rservicebus → rservicebus2}/saga/base.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/saga/data.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/saga/manager.rb +24 -26
- data/lib/{rservicebus → rservicebus2}/saga_loader.rb +7 -7
- data/lib/{rservicebus → rservicebus2}/saga_storage.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/saga_storage/dir.rb +2 -3
- data/lib/{rservicebus → rservicebus2}/saga_storage/inmemory.rb +5 -2
- data/lib/{rservicebus → rservicebus2}/sendat_manager.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/sendat_storage.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/sendat_storage/file.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/sendat_storage/inmemory.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/state_manager.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/state_storage.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/state_storage/dir.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/state_storage/inmemory.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/statistic_manager.rb +3 -3
- data/lib/{rservicebus → rservicebus2}/stats.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/subscription_manager.rb +5 -5
- data/lib/{rservicebus → rservicebus2}/subscription_storage.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/subscription_storage/file.rb +1 -1
- data/lib/{rservicebus → rservicebus2}/subscription_storage_configure.rb +2 -2
- data/lib/rservicebus2/test.rb +1 -0
- data/lib/{rservicebus → rservicebus2}/test/bus.rb +2 -2
- data/lib/{rservicebus → rservicebus2}/transporter.rb +16 -16
- data/lib/{rservicebus → rservicebus2}/usermessage/withpayload.rb +1 -1
- metadata +58 -59
- data/lib/rservicebus.rb +0 -59
- data/lib/rservicebus/subscription_storage/redis.rb +0 -69
- data/lib/rservicebus/test.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4263471148f747aa3b457b906c57ec1db20d229b
|
4
|
+
data.tar.gz: 40d77269e8ed10bc478319443773beabfa2aac1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3695eda330c3692bdeb9c1832887407d98b82690866f272d430de46e2b145919e9bb48e48fad26c3dd3c3743f6222f48e806d6fc8f6059059cc04036e173ef96
|
7
|
+
data.tar.gz: adf53536976e6c77bca157312a5408b4728c1f67c77a654de55674ec1916587288619794277bc40c3f909e2b3a50bbcf6f26f5d77ddec6a42c53fb65dcc1f2c3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'beanstalk-client'
|
5
|
-
require '
|
5
|
+
require 'rservicebus2'
|
6
6
|
|
7
7
|
def return_msg(beanstalk, job, request_nbr)
|
8
8
|
first_match = 'ruby/object:'
|
@@ -68,7 +68,7 @@ begin
|
|
68
68
|
1.upto(number_of_messages) do |request_nbr|
|
69
69
|
job = beanstalk.reserve 1
|
70
70
|
|
71
|
-
return_msg(
|
71
|
+
return_msg(beanstalk, job, request_nbr)
|
72
72
|
end
|
73
73
|
rescue StandardError => e
|
74
74
|
if e.message == 'TIMED_OUT'
|
@@ -92,7 +92,7 @@ begin
|
|
92
92
|
begin
|
93
93
|
beanstalk.watch(queue_name)
|
94
94
|
job_list = []
|
95
|
-
1.upto(index-1) do |request_nbr|
|
95
|
+
1.upto(index - 1) do |request_nbr|
|
96
96
|
job = beanstalk.reserve 1
|
97
97
|
job_list << job
|
98
98
|
end
|
data/bin/rsb_ctl
CHANGED
data/bin/rservicebus2
CHANGED
data/bin/rservicebus2-transport
CHANGED
@@ -5,12 +5,11 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
|
-
require '
|
9
|
-
require '
|
8
|
+
require 'rservicebus2'
|
9
|
+
require 'rservicebus2/Transporter'
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def run_rservicebus2_transport
|
12
|
+
RServiceBus2::Transporter.new.Run
|
13
13
|
end
|
14
14
|
|
15
15
|
run_rservicebus_transport
|
16
|
-
|
data/bin/send_empty_message
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
3
|
+
require 'rservicebus2'
|
4
|
+
require 'rservicebus2/Agent'
|
5
5
|
|
6
|
-
|
7
|
-
abort( "Usage: #{File.basename($0)} <Msg Name> <Queue Name> [Response Queue Name] [Beanstalk Host]" ) unless ARGV.length >=2 && ARGV.length <=4
|
6
|
+
abort "Usage: #{File.basename($0)} <Msg Name> <Queue Name> [Response Queue Name] [Beanstalk Host]" unless ARGV.length >=2 && ARGV.length <=4
|
8
7
|
msg_name = ARGV[0]
|
9
8
|
queue_name = ARGV[1]
|
10
9
|
response_queue_name = "#{queue_name}Response" if ARGV.length >= 3
|
11
|
-
|
10
|
+
beanstalk_host = 'beanstalk://localhost' if ARGV.length <= 4
|
12
11
|
|
13
|
-
agent =
|
14
|
-
msg =
|
12
|
+
agent = RServiceBus2::Agent.new.getAgent(URI.parse(beanstalk_host))
|
13
|
+
msg = RServiceBus2.createAnonymousClass(msg_name)
|
15
14
|
agent.sendMsg(msg, queue_name, response_queue_name)
|
data/lib/rservicebus2.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Add the currently running directory to the start of the load path
|
2
|
+
# $:.unshift File.dirname(__FILE__) + '/../../lib'
|
3
|
+
|
4
|
+
# Don't buffer stdout
|
5
|
+
$stdout.sync = true
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'yaml'
|
9
|
+
require 'uuidtools'
|
10
|
+
require 'json'
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
require 'rservicebus2/helper_functions'
|
14
|
+
require 'rservicebus2/errormessage'
|
15
|
+
require 'rservicebus2/handler_loader'
|
16
|
+
require 'rservicebus2/handler_manager'
|
17
|
+
require 'rservicebus2/appresource_configure'
|
18
|
+
require 'rservicebus2/mq'
|
19
|
+
require 'rservicebus2/host'
|
20
|
+
require 'rservicebus2/config'
|
21
|
+
require 'rservicebus2/endpointmapping'
|
22
|
+
require 'rservicebus2/stats'
|
23
|
+
require 'rservicebus2/statistic_manager'
|
24
|
+
require 'rservicebus2/audit'
|
25
|
+
|
26
|
+
require 'rservicebus2/message'
|
27
|
+
require 'rservicebus2/message/subscription'
|
28
|
+
require 'rservicebus2/message/statisticoutput'
|
29
|
+
require 'rservicebus2/message/verboseoutput'
|
30
|
+
|
31
|
+
require 'rservicebus2/usermessage/withpayload'
|
32
|
+
|
33
|
+
require 'rservicebus2/state_manager'
|
34
|
+
require 'rservicebus2/cron_manager'
|
35
|
+
require 'rservicebus2/circuitbreaker'
|
36
|
+
|
37
|
+
require 'rservicebus2/appresource'
|
38
|
+
require 'rservicebus2/resource_manager'
|
39
|
+
|
40
|
+
require 'rservicebus2/subscription_manager'
|
41
|
+
require 'rservicebus2/subscription_storage'
|
42
|
+
require 'rservicebus2/subscription_storage_configure'
|
43
|
+
|
44
|
+
require 'rservicebus2/monitor_configure'
|
45
|
+
|
46
|
+
require 'rservicebus2/agent'
|
47
|
+
|
48
|
+
require 'rservicebus2/saga_loader.rb'
|
49
|
+
require 'rservicebus2/saga/manager.rb'
|
50
|
+
require 'rservicebus2/saga/data.rb'
|
51
|
+
require 'rservicebus2/saga/base.rb'
|
52
|
+
|
53
|
+
require 'rservicebus2/saga_storage'
|
54
|
+
|
55
|
+
require 'rservicebus2/sendat_manager'
|
56
|
+
|
57
|
+
# Initial definition of the namespace
|
58
|
+
module RServiceBus
|
59
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
class QueueNotFoundForMsg < StandardError
|
3
3
|
end
|
4
4
|
|
@@ -8,7 +8,7 @@ module RServiceBus
|
|
8
8
|
def get_agent(uri)
|
9
9
|
ENV['RSBMQ'] = uri.to_s
|
10
10
|
|
11
|
-
|
11
|
+
RServiceBus2.rlog '*** Agent.getAgent has been deprecated. Set the
|
12
12
|
environment variable, RSBMQ, and simply create the class'
|
13
13
|
Agent.new
|
14
14
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
|
-
module
|
3
|
+
module RServiceBus2
|
4
4
|
# Wrapper base class for resources used by applications, allowing rservicebus
|
5
5
|
# to configure the resource - dependency injection.
|
6
6
|
class AppResource
|
@@ -13,7 +13,7 @@ module RServiceBus
|
|
13
13
|
|
14
14
|
def _connect
|
15
15
|
@connection = connect(@uri)
|
16
|
-
|
16
|
+
RServiceBus2.rlog "#{self.class.name}. Connected to, #{@uri}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def get_resource
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
|
-
module
|
3
|
+
module RServiceBus2
|
4
4
|
# Configure AppResources for an rservicebus host
|
5
5
|
class ConfigureAppResource
|
6
6
|
def get_resources(env, host, state_manager, saga_storage)
|
@@ -9,16 +9,16 @@ module RServiceBus
|
|
9
9
|
env.each do |k, v|
|
10
10
|
if v.is_a?(String) && k.start_with?('RSBFDB_')
|
11
11
|
uri = URI.parse(v)
|
12
|
-
require '
|
12
|
+
require 'rservicebus2/appresource/fluiddb'
|
13
13
|
rm.add k.sub('RSBFDB_', ''), AppResourceFluidDb.new(host, uri)
|
14
14
|
elsif v.is_a?(String) && k.start_with?('RSB_')
|
15
15
|
uri = URI.parse(v)
|
16
16
|
case uri.scheme
|
17
17
|
when 'dir'
|
18
|
-
require '
|
18
|
+
require 'rservicebus2/appresource/dir'
|
19
19
|
rm.add k.sub('RSB_', ''), AppResourceDir.new(host, uri)
|
20
20
|
when 'file'
|
21
|
-
require '
|
21
|
+
require 'rservicebus2/appresource/file'
|
22
22
|
rm.add k.sub('RSB_', ''), AppResourceFile.new(host, uri)
|
23
23
|
else
|
24
24
|
abort("Scheme, #{uri.scheme}, not recognised when configuring
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
class MessageArrivedWhileCricuitBroken < StandardError
|
3
3
|
end
|
4
4
|
|
@@ -16,10 +16,10 @@ module RServiceBus
|
|
16
16
|
|
17
17
|
def initialize(host)
|
18
18
|
@host = host
|
19
|
-
@maxnumber_of_failures =
|
20
|
-
@seconds_to_break =
|
21
|
-
@seconds_to_reset =
|
22
|
-
@reset_on_success =
|
19
|
+
@maxnumber_of_failures = RServiceBus2.get_value('RSBCB_MAX', 5)
|
20
|
+
@seconds_to_break = RServiceBus2.get_value('RSBCB_SECONDS_TO_BREAK', 60).to_i
|
21
|
+
@seconds_to_reset = RServiceBus2.get_value('RSBCB_SECONDS_TO_RESET', 60).to_i
|
22
|
+
@reset_on_success = RServiceBus2.get_value('RSBCB_RESET_ON_SUCCESS', false)
|
23
23
|
|
24
24
|
reset
|
25
25
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
# Marshals configuration information for an rservicebus host
|
3
3
|
class Config
|
4
4
|
attr_reader :app_name, :message_endpoint_mappings, :handler_path_list,
|
@@ -88,7 +88,6 @@ module RServiceBus
|
|
88
88
|
# This is a guard clause in case no Contracts have been specified
|
89
89
|
# If any guard clauses have been specified, then execution should drop
|
90
90
|
# to the second block
|
91
|
-
puts "Config.load_contracts, #{@contract_list}"
|
92
91
|
return self if get_value('CONTRACTS').nil?
|
93
92
|
|
94
93
|
get_value('CONTRACTS', './Contract').split(';').each do |path|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'parse-cron'
|
2
2
|
|
3
|
-
module
|
3
|
+
module RServiceBus2
|
4
4
|
# Globber
|
5
5
|
class Globber
|
6
6
|
def self.parse_to_regex(str)
|
@@ -48,7 +48,7 @@ module RServiceBus
|
|
48
48
|
@bus = host
|
49
49
|
@msg_names = msg_names
|
50
50
|
|
51
|
-
|
51
|
+
RServiceBus2.rlog 'Load Cron'
|
52
52
|
@list = []
|
53
53
|
ENV.each do |k, vs|
|
54
54
|
if k.start_with?('RSBCRON_')
|
@@ -67,8 +67,8 @@ module RServiceBus
|
|
67
67
|
@list.each_with_index do |v, idx|
|
68
68
|
next if now <= v['next']
|
69
69
|
|
70
|
-
|
71
|
-
@bus.send(
|
70
|
+
RServiceBus2.rlog "CronManager.Send, #{v['name']}"
|
71
|
+
@bus.send(RServiceBus2.create_anonymous_class(v['name']))
|
72
72
|
@list[idx]['next'] = v['cron'].next(now)
|
73
73
|
end
|
74
74
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
# Marshals data for message end points
|
3
3
|
# Expected format: <msg mame 1>:<end point 1>;<msg mame 2>:<end point 2>
|
4
4
|
class EndpointMapping
|
5
5
|
def get_value(name)
|
6
|
-
|
6
|
+
RServiceBus2.get_value(name)
|
7
7
|
end
|
8
8
|
|
9
9
|
def log(string, _ver = false)
|
10
|
-
|
10
|
+
RServiceBus2.log(string)
|
11
11
|
end
|
12
12
|
|
13
13
|
def configure_mapping(mapping)
|
@@ -19,7 +19,7 @@ module RServiceBus
|
|
19
19
|
exit
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
RServiceBus2.rlog "EndpointMapping.configureMapping: #{match[1]}, #{match[2]}"
|
23
23
|
@endpoints[match[1]] = match[2]
|
24
24
|
|
25
25
|
@queue_name_list.each do |q|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
def self.convert_dto_to_hash(obj)
|
3
3
|
hash = {}
|
4
4
|
obj.instance_variables.each do |var|
|
@@ -41,13 +41,13 @@ module RServiceBus
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.send_msg(msg, response_queue = 'agent')
|
44
|
-
require '
|
44
|
+
require 'rservicebus2/endpointmapping'
|
45
45
|
endpoint_mapping = EndpointMapping.new
|
46
46
|
endpoint_mapping.configure
|
47
47
|
queue_name = endpoint_mapping.get(msg.class.name)
|
48
48
|
|
49
49
|
ENV['RSBMQ'] = 'beanstalk://localhost' if ENV['RSBMQ'].nil?
|
50
|
-
agent =
|
50
|
+
agent = RServiceBus2::Agent.new
|
51
51
|
Audit.new(agent).audit_to_queue(msg)
|
52
52
|
agent.send_msg(msg, queue_name, response_queue)
|
53
53
|
|
@@ -62,7 +62,7 @@ module RServiceBus
|
|
62
62
|
|
63
63
|
def self.check_for_reply(queue_name)
|
64
64
|
ENV['RSBMQ'] = 'beanstalk://localhost' if ENV['RSBMQ'].nil?
|
65
|
-
agent =
|
65
|
+
agent = RServiceBus2::Agent.new
|
66
66
|
msg = agent.check_for_reply(queue_name)
|
67
67
|
Audit.new(agent).audit_incoming(msg)
|
68
68
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RServiceBus2
|
2
2
|
class NoHandlerFound < StandardError
|
3
3
|
end
|
4
4
|
class ClassNotFoundForMsg < StandardError
|
@@ -10,13 +10,13 @@ module RServiceBus
|
|
10
10
|
|
11
11
|
# Host process for rservicebus
|
12
12
|
class Host
|
13
|
-
attr_accessor :
|
13
|
+
attr_accessor :saga_data
|
14
14
|
|
15
15
|
# Provides a thin logging veneer
|
16
16
|
# @param [String] string Log entry
|
17
17
|
# @param [Boolean] ver Indicator for a verbose log entry
|
18
18
|
def log(string, ver = false)
|
19
|
-
|
19
|
+
RServiceBus2.log(string, ver)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Thin veneer for Configuring external resources
|
@@ -149,7 +149,7 @@ module RServiceBus
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def initialize
|
152
|
-
|
152
|
+
RServiceBus2.rlog "Current directory: #{Dir.pwd}"
|
153
153
|
@config = ConfigFromEnv.new.load_host_section
|
154
154
|
.load_contracts
|
155
155
|
.load_handler_path_list
|
@@ -2,7 +2,7 @@ require 'zlib'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'uuidtools'
|
4
4
|
|
5
|
-
module
|
5
|
+
module RServiceBus2
|
6
6
|
# This is the top level message that is passed around the bus
|
7
7
|
class Message
|
8
8
|
attr_reader :return_address, :msg_id, :remote_queue_name, :remote_host_name,
|
@@ -15,7 +15,7 @@ module RServiceBus
|
|
15
15
|
# @param [Object] returnAddress A queue to which the destination message
|
16
16
|
# handler can send replies
|
17
17
|
def initialize(msg, return_address, correlation_id = nil)
|
18
|
-
if
|
18
|
+
if RServiceBus2.check_environment_variable('RSBMSG_COMPRESS')
|
19
19
|
@compressed = true
|
20
20
|
@_msg = Zlib::Deflate.deflate(YAML.dump(msg))
|
21
21
|
else
|