rservicebus-beanstalk-webadmin 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d20b749e9747a5c231242ea64f8eeefca81383ab
4
- data.tar.gz: ffafc56ae699cdc6dd9ab0c3d2438e789a4e9723
3
+ metadata.gz: ef6a92d49546266389c6e73c6349a98aa35163b7
4
+ data.tar.gz: e9ba210ce5624d73b334a2136e91567a6925e304
5
5
  SHA512:
6
- metadata.gz: 34a6439cde238709413ee121305cf6170008be139016c3616bd4e8c399de70363a1d3b0b9d78eeba7188b3fee0a1065de9ddfb0ce8faa41f5a7d9f65caf3d2a5
7
- data.tar.gz: 77ba23f56557a0852dff38871023aba5384733963ad0344b2e0ee0716cb11b1cb82198a75bc745766b64c701abb6b7101c5a76ef048cbe4a5f054c0ad43b76ee
6
+ metadata.gz: 94d71c9425e7ecb51d4c1723af34b90d206af3f3c9cf6512633e2fafb6b8c5b16d2d6472d3cf6d00d7f1c57d98c241a6a019d2ae532e52756c6f9b93f01c0dad
7
+ data.tar.gz: 1f0ebd68edf4983f5dd229bcfa35937921dcaf89fa9ae962993424105fe53f50fa90dd2526862eea5a39e3e6d37c0bf004acbf3a5fa92cb12a25778d0f30298e
@@ -6,6 +6,7 @@ require 'sinatra'
6
6
  class RServiceBusBeanstalkAdmin < Sinatra::Base
7
7
 
8
8
  set :public_folder, File.expand_path('../../public', __FILE__)
9
+ set :bind, '0.0.0.0'
9
10
 
10
11
  before do
11
12
  @host_string = ENV['BEANSTALK_HOST'] || 'localhost:11300'
@@ -17,6 +18,10 @@ after do
17
18
  end
18
19
 
19
20
  def convert_rservicebus2_msg_to_hash(idx, body)
21
+ if body.index('RServiceBus2::Message').nil?
22
+ return Hash['idx', 'id', 'error_list', []]
23
+ end
24
+
20
25
  msg_wrapper = YAML.load(body)
21
26
 
22
27
  hash = Hash['idx', idx,
@@ -32,10 +37,38 @@ def convert_rservicebus2_msg_to_hash(idx, body)
32
37
  end
33
38
 
34
39
  hash['name'] = body.match('ruby/object:([A-Za-z0-9_:]*?)[^A-Za-z0-9_:]',
35
- '-- !ruby/object:RServiceBus::Message'.length)[1]
40
+ '-- !ruby/object:RServiceBus2::Message'.length)[1]
36
41
  hash
37
42
  end
38
43
 
44
+ def convert_rservicebus_msg_to_hash(idx, body)
45
+ require 'RServiceBus'
46
+ msg_wrapper = YAML.load(body)
47
+
48
+ hash = Hash['idx', idx,
49
+ 'msg_id', msg_wrapper.msg_id,
50
+ 'return_address', msg_wrapper.return_address,
51
+ 'error_list', []]
52
+
53
+ msg_wrapper.error_list.each do |e|
54
+ h = Hash['occurredat', e.occurredat,
55
+ 'source_queue', e.source_queue,
56
+ 'error_msg', e.error_msg]
57
+ hash['error_list'] << h
58
+ end
59
+
60
+ hash['name'] = body.match('ruby/object:([A-Za-z0-9_:]*?)[^A-Za-z0-9_:]',
61
+ '-- !ruby/object:RServiceBus2::Message'.length)[1]
62
+ hash
63
+ end
64
+
65
+ def convert_msg_to_hash(idx, body)
66
+ return convert_rservicebus2_msg_to_hash(idx, body) unless body.index('RServiceBus2::Message').nil?
67
+ return convert_rservicebus_msg_to_hash(idx, body) unless body.index('RServiceBus::Message').nil?
68
+
69
+ Hash['idx', 'id', 'error_list', []]
70
+ end
71
+
39
72
  get '/path' do
40
73
  puts File.expand_path('../../public', __FILE__)
41
74
  end
@@ -61,7 +94,7 @@ get '/tube/:name/list' do
61
94
  job = @beanstalk.reserve 1
62
95
  job_list << job
63
96
 
64
- msg = convert_rservicebus2_msg_to_hash(idx, job.body)
97
+ msg = convert_msg_to_hash(idx, job.body)
65
98
  body_list << msg
66
99
  end
67
100
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rservicebus-beanstalk-webadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine