rservicebus2 0.1.2 → 0.1.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/rservicebus2/config.rb +1 -1
- data/lib/rservicebus2/mq.rb +3 -0
- data/lib/rservicebus2/mq/file.rb +59 -0
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c20d8a34264145fc0f492c81cb8981042334f0d
|
4
|
+
data.tar.gz: c1b5e70c54069938537d663f0ca90d630611beb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd57f30d3ec6f0bb29edefb353939e8fb186931ccbdde24e5d05469842cf7e4bd95c79a434698dd9a5eb2442493fa43f8a2d7f6fe2d09c753e5240e288f65eb
|
7
|
+
data.tar.gz: e1eeba5be8ba48df45110188b51d6b66d5f44e8c361c9189007bfb39853e5c8c1b12e76f1f631fd03cb658b36c038b76b27a9fdfd2f6b4280d915a4317450b65
|
data/lib/rservicebus2/config.rb
CHANGED
@@ -133,7 +133,7 @@ module RServiceBus2
|
|
133
133
|
def load_working_dir_list
|
134
134
|
puts "Config.load_working_dir_list.1"
|
135
135
|
puts "Config.load_working_dir_list.2 #{@contract_list}"
|
136
|
-
path_list = get_value('WORKING_DIR')
|
136
|
+
path_list = get_value('WORKING_DIR', './')
|
137
137
|
return self if path_list.nil?
|
138
138
|
|
139
139
|
path_list.split(';').each do |path|
|
data/lib/rservicebus2/mq.rb
CHANGED
@@ -18,6 +18,9 @@ module RServiceBus2
|
|
18
18
|
when 'beanstalk'
|
19
19
|
require 'rservicebus2/mq/beanstalk'
|
20
20
|
mq = MQBeanstalk.new(uri)
|
21
|
+
when 'file'
|
22
|
+
require 'rservicebus2/mq/file'
|
23
|
+
mq = MQFile.new(uri)
|
21
24
|
else
|
22
25
|
abort("Scheme, #{uri.scheme}, not recognised when configuring mq,
|
23
26
|
#{string}")
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rservicebus2/mq'
|
3
|
+
|
4
|
+
module RServiceBus2
|
5
|
+
# Beanstalk client implementation.
|
6
|
+
class MQFile < MQ
|
7
|
+
# Connect to the broker
|
8
|
+
# rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
9
|
+
|
10
|
+
def initialize(uri)
|
11
|
+
if uri.is_a? URI
|
12
|
+
@uri = uri
|
13
|
+
else
|
14
|
+
puts 'uri must be a valid URI'
|
15
|
+
abort
|
16
|
+
end
|
17
|
+
|
18
|
+
FileUtils.mkdir_p(@uri.path)
|
19
|
+
@local_queue_name = RServiceBus2.get_value('APPNAME', 'RServiceBus')
|
20
|
+
FileUtils.mkdir_p("#{@uri.path}/#{@local_queue_name}")
|
21
|
+
@timeout = RServiceBus2.get_value('QUEUE_TIMEOUT', '5').to_i
|
22
|
+
end
|
23
|
+
|
24
|
+
def subscribe(queue_name)
|
25
|
+
path = "#{@uri.path}/#{queue_name}"
|
26
|
+
FileUtils.mkdir_p(path)
|
27
|
+
@local_queue_name = queue_name
|
28
|
+
end
|
29
|
+
|
30
|
+
# Get next msg from queue
|
31
|
+
def pop
|
32
|
+
time = @timeout
|
33
|
+
while time > 0
|
34
|
+
files = Dir.glob("#{@uri.path}/#{@local_queue_name}/*.msg")
|
35
|
+
if files.length > 0
|
36
|
+
@file_path = files[0]
|
37
|
+
@body = IO.read(@file_path)
|
38
|
+
return @body
|
39
|
+
end
|
40
|
+
time -= 1
|
41
|
+
sleep(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
raise NoMsgToProcess if files.length == 0
|
45
|
+
end
|
46
|
+
|
47
|
+
def return_to_queue
|
48
|
+
end
|
49
|
+
|
50
|
+
def ack
|
51
|
+
FileUtils.rm @file_path
|
52
|
+
end
|
53
|
+
|
54
|
+
def send(queue_name, msg)
|
55
|
+
FileUtils.mkdir_p("#{@uri.path}/#{queue_name}")
|
56
|
+
IO.write("#{@uri.path}/#{queue_name}/#{rand()}.msg", msg)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Irvine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuidtools
|
@@ -92,12 +92,21 @@ executables:
|
|
92
92
|
extensions: []
|
93
93
|
extra_rdoc_files: []
|
94
94
|
files:
|
95
|
+
- LICENSE
|
96
|
+
- bin/return_messages_to_source_queue
|
97
|
+
- bin/rsb_ctl
|
98
|
+
- bin/rservicebus2
|
99
|
+
- bin/rservicebus2-create
|
100
|
+
- bin/rservicebus2-init
|
101
|
+
- bin/rservicebus2-transport
|
102
|
+
- bin/send_empty_message
|
103
|
+
- lib/rservicebus2.rb
|
95
104
|
- lib/rservicebus2/agent.rb
|
105
|
+
- lib/rservicebus2/appresource.rb
|
96
106
|
- lib/rservicebus2/appresource/dir.rb
|
97
107
|
- lib/rservicebus2/appresource/file.rb
|
98
108
|
- lib/rservicebus2/appresource/fluiddb.rb
|
99
109
|
- lib/rservicebus2/appresource/fluiddb2.rb
|
100
|
-
- lib/rservicebus2/appresource.rb
|
101
110
|
- lib/rservicebus2/appresource_configure.rb
|
102
111
|
- lib/rservicebus2/audit.rb
|
103
112
|
- lib/rservicebus2/circuitbreaker.rb
|
@@ -109,53 +118,45 @@ files:
|
|
109
118
|
- lib/rservicebus2/handler_manager.rb
|
110
119
|
- lib/rservicebus2/helper_functions.rb
|
111
120
|
- lib/rservicebus2/host.rb
|
121
|
+
- lib/rservicebus2/message.rb
|
112
122
|
- lib/rservicebus2/message/statisticoutput.rb
|
113
123
|
- lib/rservicebus2/message/subscription.rb
|
114
124
|
- lib/rservicebus2/message/verboseoutput.rb
|
115
|
-
- lib/rservicebus2/
|
125
|
+
- lib/rservicebus2/monitor.rb
|
116
126
|
- lib/rservicebus2/monitor/dir.rb
|
117
127
|
- lib/rservicebus2/monitor/dirnotifier.rb
|
118
128
|
- lib/rservicebus2/monitor/message.rb
|
119
129
|
- lib/rservicebus2/monitor/xmldir.rb
|
120
|
-
- lib/rservicebus2/monitor.rb
|
121
130
|
- lib/rservicebus2/monitor_configure.rb
|
122
|
-
- lib/rservicebus2/mq/beanstalk.rb
|
123
131
|
- lib/rservicebus2/mq.rb
|
132
|
+
- lib/rservicebus2/mq/beanstalk.rb
|
133
|
+
- lib/rservicebus2/mq/file.rb
|
124
134
|
- lib/rservicebus2/resource_manager.rb
|
125
135
|
- lib/rservicebus2/saga/base.rb
|
126
136
|
- lib/rservicebus2/saga/data.rb
|
127
137
|
- lib/rservicebus2/saga/manager.rb
|
128
138
|
- lib/rservicebus2/saga_loader.rb
|
139
|
+
- lib/rservicebus2/saga_storage.rb
|
129
140
|
- lib/rservicebus2/saga_storage/dir.rb
|
130
141
|
- lib/rservicebus2/saga_storage/inmemory.rb
|
131
|
-
- lib/rservicebus2/saga_storage.rb
|
132
142
|
- lib/rservicebus2/sendat_manager.rb
|
143
|
+
- lib/rservicebus2/sendat_storage.rb
|
133
144
|
- lib/rservicebus2/sendat_storage/file.rb
|
134
145
|
- lib/rservicebus2/sendat_storage/inmemory.rb
|
135
|
-
- lib/rservicebus2/sendat_storage.rb
|
136
146
|
- lib/rservicebus2/state_manager.rb
|
147
|
+
- lib/rservicebus2/state_storage.rb
|
137
148
|
- lib/rservicebus2/state_storage/dir.rb
|
138
149
|
- lib/rservicebus2/state_storage/inmemory.rb
|
139
|
-
- lib/rservicebus2/state_storage.rb
|
140
150
|
- lib/rservicebus2/statistic_manager.rb
|
141
151
|
- lib/rservicebus2/stats.rb
|
142
152
|
- lib/rservicebus2/subscription_manager.rb
|
143
|
-
- lib/rservicebus2/subscription_storage/file.rb
|
144
153
|
- lib/rservicebus2/subscription_storage.rb
|
154
|
+
- lib/rservicebus2/subscription_storage/file.rb
|
145
155
|
- lib/rservicebus2/subscription_storage_configure.rb
|
146
|
-
- lib/rservicebus2/test/bus.rb
|
147
156
|
- lib/rservicebus2/test.rb
|
157
|
+
- lib/rservicebus2/test/bus.rb
|
148
158
|
- lib/rservicebus2/transporter.rb
|
149
159
|
- lib/rservicebus2/usermessage/withpayload.rb
|
150
|
-
- lib/rservicebus2.rb
|
151
|
-
- bin/return_messages_to_source_queue
|
152
|
-
- bin/rsb_ctl
|
153
|
-
- bin/rservicebus2
|
154
|
-
- bin/rservicebus2-create
|
155
|
-
- bin/rservicebus2-init
|
156
|
-
- bin/rservicebus2-transport
|
157
|
-
- bin/send_empty_message
|
158
|
-
- LICENSE
|
159
160
|
homepage: http://rubygems.org/gems/rservicebus2
|
160
161
|
licenses:
|
161
162
|
- LGPL-3.0
|
@@ -176,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
177
|
version: '0'
|
177
178
|
requirements: []
|
178
179
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.
|
180
|
+
rubygems_version: 2.5.2.1
|
180
181
|
signing_key:
|
181
182
|
specification_version: 4
|
182
183
|
summary: RServiceBus
|