rservicebus 0.1.74 → 0.1.75
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/bin/ReturnMessagesToSourceQueue +18 -18
- data/bin/SendEmptyMessage +3 -3
- data/bin/rsb_ctl +10 -10
- data/bin/rservicebus-create +4 -4
- data/bin/rservicebus-init +7 -6
- data/lib/rservicebus.rb +49 -49
- data/lib/rservicebus/Agent.rb +4 -4
- data/lib/rservicebus/AppResource.rb +4 -4
- data/lib/rservicebus/AppResource/Dir.rb +3 -3
- data/lib/rservicebus/AppResource/FluidDb.rb +1 -1
- data/lib/rservicebus/AppResource/FluidDbFirebird.rb +1 -1
- data/lib/rservicebus/AppResource/FluidDbMysql.rb +4 -4
- data/lib/rservicebus/AppResource/FluidDbMysql2.rb +4 -4
- data/lib/rservicebus/AppResource/FluidDbPgsql.rb +4 -4
- data/lib/rservicebus/AppResource/FluidDbTinyTds.rb +1 -1
- data/lib/rservicebus/AppResource/Mysql.rb +2 -2
- data/lib/rservicebus/AppResource/Redis.rb +1 -1
- data/lib/rservicebus/AppResource/ScpDownload.rb +51 -0
- data/lib/rservicebus/AppResource/ScpUpload.rb +3 -2
- data/lib/rservicebus/AppResource/Smb.rb +3 -3
- data/lib/rservicebus/AppResource/SmbDir.rb +2 -2
- data/lib/rservicebus/AppResource/SmbFile.rb +1 -1
- data/lib/rservicebus/Audit.rb +9 -9
- data/lib/rservicebus/CircuitBreaker.rb +4 -4
- data/lib/rservicebus/Config.rb +46 -46
- data/lib/rservicebus/ConfigureAppResource.rb +64 -63
- data/lib/rservicebus/ConfigureMonitor.rb +12 -12
- data/lib/rservicebus/ConfigureSubscriptionStorage.rb +5 -5
- data/lib/rservicebus/CronManager.rb +8 -8
- data/lib/rservicebus/EndpointMapping.rb +11 -11
- data/lib/rservicebus/HandlerLoader.rb +33 -33
- data/lib/rservicebus/HandlerManager.rb +2 -2
- data/lib/rservicebus/Host.rb +58 -58
- data/lib/rservicebus/MQ.rb +21 -21
- data/lib/rservicebus/MQ/Beanstalk.rb +9 -9
- data/lib/rservicebus/MQ/RabbitMq.rb +5 -5
- data/lib/rservicebus/MQ/Redis.rb +3 -3
- data/lib/rservicebus/Message.rb +11 -11
- data/lib/rservicebus/Monitor.rb +5 -5
- data/lib/rservicebus/Monitor/CsvDir.rb +5 -5
- data/lib/rservicebus/Monitor/CsvPerLine.rb +5 -5
- data/lib/rservicebus/Monitor/Dir.rb +34 -34
- data/lib/rservicebus/Monitor/DirNotifier.rb +15 -15
- data/lib/rservicebus/ResourceManager.rb +2 -2
- data/lib/rservicebus/Saga/Manager.rb +18 -18
- data/lib/rservicebus/SagaLoader.rb +19 -19
- data/lib/rservicebus/SagaStorage.rb +4 -4
- data/lib/rservicebus/SagaStorage/Dir.rb +12 -12
- data/lib/rservicebus/SendAtManager.rb +4 -4
- data/lib/rservicebus/SendAtStorage.rb +5 -5
- data/lib/rservicebus/SendAtStorage/File.rb +3 -3
- data/lib/rservicebus/StateManager.rb +2 -2
- data/lib/rservicebus/StateStorage.rb +2 -2
- data/lib/rservicebus/StateStorage/Dir.rb +11 -11
- data/lib/rservicebus/StateStorage/InMemory.rb +1 -1
- data/lib/rservicebus/StatisticManager.rb +2 -2
- data/lib/rservicebus/SubscriptionManager.rb +2 -2
- data/lib/rservicebus/SubscriptionStorage.rb +4 -4
- data/lib/rservicebus/SubscriptionStorage/File.rb +3 -3
- data/lib/rservicebus/SubscriptionStorage/Redis.rb +10 -10
- data/lib/rservicebus/Test.rb +2 -2
- data/lib/rservicebus/Test/Bus.rb +2 -2
- data/lib/rservicebus/Test/Redis.rb +1 -1
- data/lib/rservicebus/Transporter.rb +15 -15
- data/lib/rservicebus/helper_functions.rb +15 -15
- metadata +13 -12
data/lib/rservicebus/MQ.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'uri'
|
4
4
|
|
5
5
|
class JobTooBigError<StandardError
|
6
6
|
end
|
@@ -17,20 +17,20 @@ module RServiceBus
|
|
17
17
|
|
18
18
|
|
19
19
|
def MQ.get
|
20
|
-
mqString = RServiceBus.getValue(
|
20
|
+
mqString = RServiceBus.getValue( 'RSBMQ', 'beanstalk://localhost');
|
21
21
|
uri = URI.parse( mqString )
|
22
22
|
|
23
23
|
case uri.scheme
|
24
|
-
when
|
25
|
-
require
|
24
|
+
when 'beanstalk'
|
25
|
+
require 'rservicebus/MQ/Beanstalk'
|
26
26
|
mq = MQ_Beanstalk.new( uri )
|
27
27
|
|
28
|
-
when
|
29
|
-
require
|
28
|
+
when 'redis'
|
29
|
+
require 'rservicebus/MQ/Redis'
|
30
30
|
mq = MQ_Redis.new( uri )
|
31
31
|
|
32
|
-
when
|
33
|
-
require
|
32
|
+
when 'rabbitmq'
|
33
|
+
require 'rservicebus/MQ/RabbitMq'
|
34
34
|
mq = MQ_RabbitMq.new( uri )
|
35
35
|
|
36
36
|
else
|
@@ -49,26 +49,26 @@ module RServiceBus
|
|
49
49
|
if uri.is_a? URI then
|
50
50
|
@uri = uri
|
51
51
|
else
|
52
|
-
puts
|
52
|
+
puts 'uri must be a valid URI'
|
53
53
|
abort()
|
54
54
|
end
|
55
55
|
|
56
|
-
if uri.path ==
|
57
|
-
@localQueueName = RServiceBus.getValue(
|
56
|
+
if uri.path == '' || uri.path == '/' then
|
57
|
+
@localQueueName = RServiceBus.getValue( 'APPNAME', 'RServiceBus')
|
58
58
|
else
|
59
59
|
@localQueueName = uri.path
|
60
|
-
@localQueueName[0] =
|
60
|
+
@localQueueName[0] = ''
|
61
61
|
end
|
62
62
|
|
63
|
-
if @localQueueName ==
|
63
|
+
if @localQueueName == '' then
|
64
64
|
puts "@localQueueName: #{@localQueueName}"
|
65
|
-
puts
|
65
|
+
puts 'Queue name must be supplied '
|
66
66
|
puts "*** uri, #{uri}, needs to contain a queue name"
|
67
|
-
puts
|
67
|
+
puts '*** the structure is scheme://host[:port]/queuename'
|
68
68
|
abort()
|
69
69
|
end
|
70
70
|
|
71
|
-
@timeout = RServiceBus.getValue(
|
71
|
+
@timeout = RServiceBus.getValue( 'QUEUE_TIMEOUT', '5').to_i
|
72
72
|
self.connect(uri.host, uri.port)
|
73
73
|
self.subscribe( @localQueueName )
|
74
74
|
end
|
@@ -78,24 +78,24 @@ module RServiceBus
|
|
78
78
|
# @param [String] host machine runnig the mq
|
79
79
|
# @param [String] port port the mq is running on
|
80
80
|
def connect( host, port )
|
81
|
-
raise
|
81
|
+
raise 'Method, connect, needs to be implemented'
|
82
82
|
end
|
83
83
|
|
84
84
|
# Connect to the receiving queue
|
85
85
|
#
|
86
86
|
# @param [String] queuename name of the receiving queue
|
87
87
|
def subscribe( queuename )
|
88
|
-
raise
|
88
|
+
raise 'Method, subscribe, needs to be implemented'
|
89
89
|
end
|
90
90
|
|
91
91
|
# Get next msg from queue
|
92
92
|
def pop
|
93
|
-
raise
|
93
|
+
raise 'Method, pop, needs to be implemented'
|
94
94
|
end
|
95
95
|
|
96
96
|
# "Commit" the pop
|
97
97
|
def ack
|
98
|
-
raise
|
98
|
+
raise 'Method, ack, needs to be implemented'
|
99
99
|
end
|
100
100
|
|
101
101
|
# At least called in the Host rescue block, to ensure all network links are healthy
|
@@ -106,7 +106,7 @@ module RServiceBus
|
|
106
106
|
begin
|
107
107
|
@connection.close
|
108
108
|
rescue
|
109
|
-
puts
|
109
|
+
puts 'AppResource. An error was raised while closing connection to, ' + @uri.to_s
|
110
110
|
end
|
111
111
|
|
112
112
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'beanstalk-client'
|
4
|
+
require 'rservicebus/MQ'
|
5
5
|
|
6
6
|
# Beanstalk client implementation.
|
7
7
|
#
|
@@ -16,16 +16,16 @@ module RServiceBus
|
|
16
16
|
begin
|
17
17
|
@beanstalk = Beanstalk::Pool.new([string])
|
18
18
|
|
19
|
-
@max_job_size = @beanstalk.stats[
|
19
|
+
@max_job_size = @beanstalk.stats['max-job-size']
|
20
20
|
if @max_job_size < 4194304 then
|
21
21
|
puts "***WARNING: Lowest recommended.max-job-size is 4m, current max-job-size, #{@max_job_size.to_f / (1024*1024)}m"
|
22
|
-
puts
|
22
|
+
puts '***WARNING: Set the job size with the -z switch, eg /usr/local/bin/beanstalkd -z 4194304'
|
23
23
|
end
|
24
24
|
rescue Exception => e
|
25
|
-
puts
|
25
|
+
puts 'Error connecting to Beanstalk'
|
26
26
|
puts "Host string, #{string}"
|
27
|
-
if e.message ==
|
28
|
-
puts
|
27
|
+
if e.message == 'Beanstalk::NotConnected' then
|
28
|
+
puts '***Most likely, beanstalk is not running. Start beanstalk, and try running this again.'
|
29
29
|
puts "***If you still get this error, check beanstalk is running at, #{string}"
|
30
30
|
else
|
31
31
|
puts e.message
|
@@ -46,7 +46,7 @@ module RServiceBus
|
|
46
46
|
begin
|
47
47
|
@job = @beanstalk.reserve @timeout
|
48
48
|
rescue Exception => e
|
49
|
-
if e.message ==
|
49
|
+
if e.message == 'TIMED_OUT' then
|
50
50
|
raise NoMsgToProcess.new
|
51
51
|
end
|
52
52
|
raise e
|
@@ -68,7 +68,7 @@ module RServiceBus
|
|
68
68
|
# At least called in the Host rescue block, to ensure all network links are healthy
|
69
69
|
def send( queueName, msg )
|
70
70
|
if msg.length > @max_job_size then
|
71
|
-
puts
|
71
|
+
puts '***Attempting to send a msg which will not fit on queue.'
|
72
72
|
puts "***Msg size, #{msg.length}, max msg size, #{@max_job_size}."
|
73
73
|
raise JobTooBigError.new( "Msg size, #{msg.length}, max msg size, #{@max_job_size}" )
|
74
74
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bunny'
|
4
|
+
require 'rservicebus/MQ'
|
5
5
|
|
6
6
|
# Beanstalk client implementation.
|
7
7
|
#
|
@@ -22,10 +22,10 @@ module RServiceBus
|
|
22
22
|
@x = @ch.default_exchange
|
23
23
|
|
24
24
|
rescue Exception => e
|
25
|
-
puts
|
25
|
+
puts 'Error connecting to Beanstalk'
|
26
26
|
puts "Host string, #{string}"
|
27
|
-
if e.message ==
|
28
|
-
puts
|
27
|
+
if e.message == 'Beanstalk::NotConnected' then
|
28
|
+
puts '***Most likely, beanstalk is not running. Start beanstalk, and try running this again.'
|
29
29
|
puts "***If you still get this error, check beanstalk is running at, #{string}"
|
30
30
|
else
|
31
31
|
puts e.message
|
data/lib/rservicebus/MQ/Redis.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'rservicebus/MQ'
|
4
|
+
require 'redis'
|
5
5
|
|
6
6
|
# Beanstalk client implementation.
|
7
7
|
#
|
@@ -18,7 +18,7 @@ module RServiceBus
|
|
18
18
|
|
19
19
|
rescue Exception => e
|
20
20
|
puts e.message
|
21
|
-
puts
|
21
|
+
puts 'Error connecting to Redis for mq'
|
22
22
|
puts "Host string, #{string}"
|
23
23
|
abort()
|
24
24
|
end
|
data/lib/rservicebus/Message.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require 'zlib'
|
4
|
+
require 'yaml'
|
5
|
+
require 'uuidtools'
|
6
6
|
|
7
7
|
#This is the top level message that is passed around the bus
|
8
8
|
class Message
|
@@ -14,12 +14,12 @@ module RServiceBus
|
|
14
14
|
# @param [Object] msg The msg to be sent
|
15
15
|
# @param [Object] returnAddress A queue to which the destination message handler can send replies
|
16
16
|
def initialize( msg, returnAddress, correlationId=nil )
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
unless RServiceBus.checkEnvironmentVariable('RSBMSG_COMPRESS') then
|
18
|
+
@compressed = false
|
19
|
+
@_msg=YAML::dump(msg)
|
20
|
+
else
|
21
|
+
@compressed = true
|
22
|
+
@_msg=Zlib::Deflate.deflate(YAML::dump(msg))
|
23
23
|
end
|
24
24
|
|
25
25
|
@correlationId = correlationId
|
@@ -66,10 +66,10 @@ module RServiceBus
|
|
66
66
|
return YAML::load( @_msg )
|
67
67
|
end
|
68
68
|
rescue ArgumentError => e
|
69
|
-
raise e if e.message.index(
|
69
|
+
raise e if e.message.index('undefined class/module ').nil?
|
70
70
|
|
71
71
|
puts e.message
|
72
|
-
msg_name = e.message.sub(
|
72
|
+
msg_name = e.message.sub( 'undefined class/module ', '')
|
73
73
|
|
74
74
|
raise ClassNotFoundForMsg.new( msg_name )
|
75
75
|
end
|
data/lib/rservicebus/Monitor.rb
CHANGED
@@ -12,18 +12,18 @@ module RServiceBus
|
|
12
12
|
# The method which actually connects to the resource.
|
13
13
|
#
|
14
14
|
def connect(uri)
|
15
|
-
raise
|
15
|
+
raise 'Method, connect, needs to be implemented for resource'
|
16
16
|
end
|
17
17
|
|
18
18
|
# The method which actually connects to the resource.
|
19
19
|
#
|
20
20
|
def Look
|
21
|
-
raise
|
21
|
+
raise 'Method, Look, needs to be implemented for the Monitor'
|
22
22
|
end
|
23
23
|
|
24
24
|
def _connect
|
25
25
|
@connection = self.connect(@uri)
|
26
|
-
@Bus.log "#{self.class.name}. Connected to, #{@uri.to_s}"
|
26
|
+
@Bus.log "#{self.class.name}. Connected to, #{@uri.to_s}" if ENV['QUIET'].nil?
|
27
27
|
end
|
28
28
|
|
29
29
|
# Resources are attached resources, and can be specified using the URI syntax.
|
@@ -49,8 +49,8 @@ module RServiceBus
|
|
49
49
|
begin
|
50
50
|
self.finished
|
51
51
|
rescue Exception => e
|
52
|
-
puts
|
53
|
-
puts
|
52
|
+
puts '** Monitor. An error was raised while closing connection to, ' + @uri.to_s
|
53
|
+
puts 'Message: ' + e.message
|
54
54
|
puts e.backtrace
|
55
55
|
end
|
56
56
|
|
@@ -8,9 +8,9 @@ module RServiceBus
|
|
8
8
|
|
9
9
|
def checkPayloadForNumberOfColumns( payload )
|
10
10
|
return if @QueryStringParts.nil?
|
11
|
-
return unless @QueryStringParts.has_key?(
|
11
|
+
return unless @QueryStringParts.has_key?('cols')
|
12
12
|
|
13
|
-
cols = @QueryStringParts[
|
13
|
+
cols = @QueryStringParts['cols'][0].to_i
|
14
14
|
payload.each_with_index do |row, idx|
|
15
15
|
if row.length != cols then
|
16
16
|
raise "Expected number of columns, #{cols}, Actual number of columns, #{row.length}, on line, #{idx}"
|
@@ -20,9 +20,9 @@ module RServiceBus
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def checkSendHash
|
23
|
-
if !@QueryStringParts.nil? && @QueryStringParts.has_key?(
|
24
|
-
flag = @QueryStringParts[
|
25
|
-
return flag ==
|
23
|
+
if !@QueryStringParts.nil? && @QueryStringParts.has_key?('hash') then
|
24
|
+
flag = @QueryStringParts['hash'][0]
|
25
|
+
return flag == 'Y'
|
26
26
|
end
|
27
27
|
|
28
28
|
return false
|
@@ -6,9 +6,9 @@ module RServiceBus
|
|
6
6
|
class Monitor_CsvPerLineDir<Monitor_Dir
|
7
7
|
|
8
8
|
def checkPayloadForNumberOfColumns( payload )
|
9
|
-
if !@QueryStringParts.nil? && @QueryStringParts.has_key?(
|
9
|
+
if !@QueryStringParts.nil? && @QueryStringParts.has_key?('cols') then
|
10
10
|
|
11
|
-
cols = @QueryStringParts[
|
11
|
+
cols = @QueryStringParts['cols'][0].to_i
|
12
12
|
payload.each_with_index do |row, idx|
|
13
13
|
if row.length != cols then
|
14
14
|
raise "Expected number of columns, #{cols}, Actual number of columns, #{row.length}, on line, #{idx}"
|
@@ -19,9 +19,9 @@ module RServiceBus
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def checkSendHash
|
22
|
-
if !@QueryStringParts.nil? && @QueryStringParts.has_key?(
|
23
|
-
flag = @QueryStringParts[
|
24
|
-
return flag ==
|
22
|
+
if !@QueryStringParts.nil? && @QueryStringParts.has_key?('hash') then
|
23
|
+
flag = @QueryStringParts['hash'][0]
|
24
|
+
return flag == 'Y'
|
25
25
|
end
|
26
26
|
|
27
27
|
return false
|
@@ -15,10 +15,10 @@ module RServiceBus
|
|
15
15
|
#Pass the path through the Dir object to check syntax on startup
|
16
16
|
begin
|
17
17
|
inputDir = Dir.new( uri.path )
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
unless File.writable?(uri.path) then
|
19
|
+
puts "***** Directory is not writable, #{uri.path}."
|
20
|
+
puts "***** Make the directory, #{uri.path}, writable and try again."
|
21
|
+
abort()
|
22
22
|
end
|
23
23
|
rescue Errno::ENOENT => e
|
24
24
|
puts "***** Directory does not exist, #{uri.path}."
|
@@ -38,32 +38,32 @@ module RServiceBus
|
|
38
38
|
return if uri.query.nil?
|
39
39
|
parts = CGI.parse(uri.query)
|
40
40
|
@QueryStringParts = parts
|
41
|
-
if parts.has_key?(
|
42
|
-
archiveUri = URI.parse( parts[
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
if parts.has_key?('archive') then
|
42
|
+
archiveUri = URI.parse( parts['archive'][0] )
|
43
|
+
unless File.directory?(archiveUri.path) then
|
44
|
+
puts '***** Archive file name templating not yet supported.'
|
45
|
+
puts "***** Directory's only."
|
46
|
+
abort()
|
47
47
|
end
|
48
48
|
@ArchiveDir = archiveUri.path
|
49
49
|
end
|
50
50
|
|
51
|
-
if parts.has_key?(
|
52
|
-
if parts[
|
53
|
-
puts
|
54
|
-
puts
|
51
|
+
if parts.has_key?('inputfilter') then
|
52
|
+
if parts['inputfilter'].count > 1 then
|
53
|
+
puts 'Too many inputfilters specified.'
|
54
|
+
puts '*** ZIP, or GZ are the only valid inputfilters.'
|
55
55
|
abort();
|
56
56
|
end
|
57
57
|
|
58
|
-
if parts[
|
59
|
-
elsif parts[
|
60
|
-
elsif parts[
|
58
|
+
if parts['inputfilter'][0] == 'ZIP' then
|
59
|
+
elsif parts['inputfilter'][0] == 'GZ' then
|
60
|
+
elsif parts['inputfilter'][0] == 'TAR' then
|
61
61
|
else
|
62
|
-
puts
|
63
|
-
puts
|
62
|
+
puts 'Invalid inputfilter specified.'
|
63
|
+
puts '*** ZIP, or GZ are the only valid inputfilters.'
|
64
64
|
abort();
|
65
65
|
end
|
66
|
-
@InputFilter << parts[
|
66
|
+
@InputFilter << parts['inputfilter'][0]
|
67
67
|
end
|
68
68
|
|
69
69
|
|
@@ -88,15 +88,15 @@ module RServiceBus
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def ReadContentFromTarFile( filePath )
|
91
|
-
raise
|
92
|
-
content =
|
91
|
+
raise 'Not supported yet'
|
92
|
+
content = ''
|
93
93
|
# Gem::Package::TarReader.new( filePath ).each do |entry|
|
94
94
|
# content = entry.read
|
95
95
|
return content
|
96
96
|
end
|
97
97
|
|
98
98
|
def ReadContentFromFile( filePath )
|
99
|
-
content =
|
99
|
+
content = ''
|
100
100
|
if @InputFilter.length > 0 then
|
101
101
|
if @InputFilter[0] == 'ZIP' then
|
102
102
|
entry, content = self.ReadContentFromZipFile( filePath )
|
@@ -129,17 +129,17 @@ module RServiceBus
|
|
129
129
|
fileList.each do |filePath|
|
130
130
|
RServiceBus.log "Ready to process, #{filePath}"
|
131
131
|
content = self.ProcessPath( filePath )
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
132
|
+
|
133
|
+
unless @ArchiveDir.nil? then
|
134
|
+
basename = File.basename(filePath)
|
135
|
+
newFilePath = @ArchiveDir + '/' + basename + '.' + DateTime.now.strftime('%Y%m%d%H%M%S%L') + '.zip'
|
136
|
+
RServiceBus.log "Writing to archive, #{newFilePath}"
|
137
|
+
|
138
|
+
Zip::ZipOutputStream.open(newFilePath) {
|
139
|
+
|zos|
|
140
|
+
zos.put_next_entry(basename)
|
141
|
+
zos.puts content
|
142
|
+
}
|
143
143
|
end
|
144
144
|
File.unlink( filePath )
|
145
145
|
|
@@ -10,10 +10,10 @@ module RServiceBus
|
|
10
10
|
#Pass the path through the Dir object to check syntax on startup
|
11
11
|
begin
|
12
12
|
self.open_folder uri.path
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
unless self.file_writable?(uri.path) then
|
14
|
+
puts "***** Directory is not writable, #{uri.path}."
|
15
|
+
puts "***** Make the directory, #{uri.path}, writable and try again."
|
16
|
+
abort()
|
17
17
|
end
|
18
18
|
rescue Errno::ENOENT => e
|
19
19
|
puts "***** Directory does not exist, #{uri.path}."
|
@@ -30,21 +30,21 @@ module RServiceBus
|
|
30
30
|
@Path = uri.path
|
31
31
|
|
32
32
|
if uri.query.nil?
|
33
|
-
puts
|
34
|
-
puts
|
33
|
+
puts '***** Processing Directory is not specified.'
|
34
|
+
puts '***** Specify the Processing Directory as a query string in the Path URI'
|
35
35
|
puts "***** eg, '/#{uri.path}?processing=*ProcessingDir*"
|
36
36
|
abort()
|
37
37
|
else
|
38
38
|
parts = CGI.parse(uri.query)
|
39
39
|
|
40
|
-
if parts.has_key?
|
41
|
-
processingUri = URI.parse parts[
|
40
|
+
if parts.has_key? 'processing' then
|
41
|
+
processingUri = URI.parse parts['processing'][0]
|
42
42
|
begin
|
43
43
|
self.open_folder processingUri.path
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
unless self.file_writable?(processingUri.path) then
|
45
|
+
puts "***** Processing Directory is not writable, #{processingUri.path}."
|
46
|
+
puts "***** Make the directory, #{processingUri.path}, writable and try again."
|
47
|
+
abort()
|
48
48
|
end
|
49
49
|
rescue Errno::ENOENT => e
|
50
50
|
puts "***** Processing Directory does not exist, #{processingUri.path}."
|
@@ -61,9 +61,9 @@ module RServiceBus
|
|
61
61
|
@ProcessingFolder = processingUri.path
|
62
62
|
end
|
63
63
|
|
64
|
-
@Filter =
|
65
|
-
if parts.has_key?
|
66
|
-
@Filter = parts[
|
64
|
+
@Filter = '*'
|
65
|
+
if parts.has_key? 'filter' then
|
66
|
+
@Filter = parts['filter'][0]
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|