rservicebus-beanstalk-webadmin 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/rservicebus-beanstalk-webadmin.rb +35 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef6a92d49546266389c6e73c6349a98aa35163b7
|
4
|
+
data.tar.gz: e9ba210ce5624d73b334a2136e91567a6925e304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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 =
|
97
|
+
msg = convert_msg_to_hash(idx, job.body)
|
65
98
|
body_list << msg
|
66
99
|
end
|
67
100
|
|