rservicebus 0.0.43 → 0.0.44

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,7 @@ module RServiceBus
57
57
  when "xmldir"
58
58
  require "rservicebus/Monitor/XmlDir"
59
59
  monitor = Monitor_XmlDir.new( @host, name, uri )
60
-
60
+
61
61
  when "dir"
62
62
  require "rservicebus/Monitor/Dir"
63
63
  monitor = Monitor_Dir.new( @host, name, uri )
@@ -1,18 +1,34 @@
1
+ require 'cgi'
1
2
 
2
3
  class Monitor_Dir<Monitor
3
4
 
4
5
  @Path
5
-
6
+ @ArchiveDir
7
+
6
8
  def connect(uri)
7
9
  #Pass the path through the Dir object to check syntax on startup
8
10
  inputDir = Dir.new( uri.path )
9
11
  @Path = inputDir.path
12
+
13
+ return if uri.query.nil?
14
+ parts = CGI.parse(uri.query)
15
+ return if parts["archive"].nil?
16
+
17
+ archiveUri = URI.parse( parts["archive"][0] )
18
+ if !File.directory?( archiveUri.path ) then
19
+ puts "***** Archive file name templating not yet supported."
20
+ puts "***** Directory's only."
21
+ abort()
22
+ end
23
+
24
+ @ArchiveDir = archiveUri.path
25
+
10
26
  end
11
-
27
+
12
28
  def ProcessPath( path )
13
29
  return IO.read( path )
14
30
  end
15
-
31
+
16
32
  def ProcessFile( file )
17
33
  payload = self.ProcessPath( file )
18
34
 
@@ -23,9 +39,16 @@ class Monitor_Dir<Monitor
23
39
  Dir.glob( "#{@Path}/*" ).each do |file|
24
40
  self.ProcessFile( file )
25
41
 
26
- File.unlink( file )
42
+ if @ArchiveDir.nil? then
43
+ File.unlink( file )
44
+ else
45
+ basename = File.basename( file )
46
+ newFilePath = @ArchiveDir + "/" + basename + "." + DateTime.now.strftime( "%Y%m%d%H%M%S%L")
47
+ @Bus.log "Writing to archive, #{newFilePath}", true
48
+ File.rename( file, newFilePath )
49
+ end
27
50
  end
28
51
 
29
52
  end
30
-
53
+
31
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rservicebus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-09 00:00:00.000000000 Z
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby interpretation of NServiceBus
15
15
  email: guy@guyirvine.com