omf_common 6.2.0.pre.2 → 6.2.0
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 +8 -8
- data/lib/omf_common/comm/amqp/amqp_topic.rb +7 -12
- data/lib/omf_common/comm/xmpp/topic.rb +1 -1
- data/lib/omf_common/exec_app.rb +5 -1
- data/lib/omf_common/message.rb +4 -0
- data/omf_common.gemspec +1 -1
- data/test/omf_common/comm/topic_spec.rb +1 -0
- data/test/omf_common/comm/xmpp/communicator_spec.rb +3 -0
- data/test/omf_common/comm/xmpp/topic_spec.rb +2 -0
- data/test/omf_common/comm_spec.rb +0 -6
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjJhMzc2NmQ5MWVhMzVmODhmZjZhMmI2YzFjZmJlMDdmZGM3YzU3MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTQ0MGMyMjkwOWRmMDY5MjZlMjZlYjFkODQzZDkwMTlhMzE5ODVkNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDIwYWY5YTIwYzdkNDNjNzNjNDM2NTM3NmY0NGUxNjMzYWZkYmIzMTM1ZGRi
|
10
|
+
OTI3NjE5ODdlNzE2ZTk2MDk0Y2EzMDBiNWY1NjdjMzVhMmM5ZDFjYTk5NGVi
|
11
|
+
NjUzOTU3ZGIyYTgyODY0ZmIzZWM3ODllM2ZkZWYzM2ViNWVmZGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWZmMDhhODE4OTRmYzExYWUwZWIwNmMwMjMwMTM1M2I4NzY1ZWYxZmVmNmU4
|
14
|
+
MTFjZGIwOTg3NGUzNGU3ZTY5ODk0NjllOTQ3NDJlOTYwMjc2NjA3MjVhOThl
|
15
|
+
ODU4NTU2ZDFjZDk2OGYxZDA0ZTFlMzU1Njk4NDFkYTNjZjk0MmE=
|
@@ -37,6 +37,11 @@ module OmfCommon
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def unsubscribe(key)
|
41
|
+
super
|
42
|
+
@exchange.delete
|
43
|
+
end
|
44
|
+
|
40
45
|
|
41
46
|
private
|
42
47
|
|
@@ -49,32 +54,22 @@ module OmfCommon
|
|
49
54
|
@lock = Monitor.new
|
50
55
|
@subscribed = false
|
51
56
|
@on_subscribed_handlers = []
|
52
|
-
|
57
|
+
# Monitor o.op & o.info by default
|
58
|
+
@routing_key = opts[:routing_key] || "o.*"
|
53
59
|
|
54
|
-
# @communicator.on_reconnect(self) do
|
55
|
-
# info "Resubscribe '#{self}'"
|
56
|
-
# _init_amqp
|
57
|
-
# end
|
58
60
|
_init_amqp
|
59
61
|
end
|
60
62
|
|
61
63
|
def _init_amqp()
|
62
64
|
channel = @communicator.channel
|
63
65
|
@exchange = channel.topic(id, :auto_delete => true)
|
64
|
-
# @exchange.on_connection_interruption do |ex|
|
65
|
-
# warn "Exchange #{ex.name} detected connection interruption"
|
66
|
-
# @exchange = nil
|
67
|
-
# end
|
68
66
|
channel.queue("", :exclusive => true, :auto_delete => true) do |queue|
|
69
|
-
#puts "QQ1(#{id}): #{queue}"
|
70
67
|
queue.bind(@exchange, routing_key: @routing_key)
|
71
68
|
|
72
69
|
queue.subscribe do |headers, payload|
|
73
|
-
#puts "===(#{id}) Incoming message '#{headers.content_type}'"
|
74
70
|
debug "Received message on #{@address} | #{@routing_key}"
|
75
71
|
MPReceived.inject(Time.now.to_f, @address, payload.to_s[/mid\":\"(.{36})/, 1]) if OmfCommon::Measure.enabled?
|
76
72
|
Message.parse(payload, headers.content_type) do |msg|
|
77
|
-
#puts "---(#{id}) Parsed message '#{msg}'"
|
78
73
|
on_incoming_message(msg)
|
79
74
|
end
|
80
75
|
end
|
data/lib/omf_common/exec_app.rb
CHANGED
@@ -46,10 +46,14 @@ class ExecApp
|
|
46
46
|
# @param [String] id of the application to return
|
47
47
|
def self.[](id)
|
48
48
|
app = @@all_apps[id]
|
49
|
-
|
49
|
+
warn "Unknown application '#{id}/#{id.class}'" if app.nil?
|
50
50
|
return app
|
51
51
|
end
|
52
52
|
|
53
|
+
def self.has?(id)
|
54
|
+
@@all_apps.has_key?(id)
|
55
|
+
end
|
56
|
+
|
53
57
|
def self.signal_all(signal = 'KILL')
|
54
58
|
@@all_apps.each_value { |app| app.signal(signal) }
|
55
59
|
end
|
data/lib/omf_common/message.rb
CHANGED
data/omf_common.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
23
|
# specify any dependencies here; for example:
|
24
|
-
s.add_development_dependency "minitest"
|
24
|
+
s.add_development_dependency "minitest", "~> 5.5.1"
|
25
25
|
s.add_development_dependency "evented-spec", "~> 1.0.0.beta"
|
26
26
|
s.add_development_dependency "simplecov"
|
27
27
|
s.add_development_dependency "pry"
|
@@ -4,6 +4,7 @@
|
|
4
4
|
# By downloading or using this software you accept the terms and the liability disclaimer in the License.
|
5
5
|
|
6
6
|
require 'test_helper'
|
7
|
+
require 'omf_common/message/json/json_message'
|
7
8
|
|
8
9
|
describe OmfCommon::Comm::Topic do
|
9
10
|
describe "when using factory method to initialise" do
|
@@ -28,6 +28,7 @@ describe "Using XMPP communicator" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "must allow you to connect" do
|
31
|
+
skip
|
31
32
|
@xmpp_comm.on_connected do |c|
|
32
33
|
assert_equal :xmpp, c.conn_info[:proto]
|
33
34
|
assert_match /#{Socket.gethostname}/, c.conn_info[:user]
|
@@ -37,6 +38,7 @@ describe "Using XMPP communicator" do
|
|
37
38
|
end
|
38
39
|
|
39
40
|
it "must construct topic address string" do
|
41
|
+
skip
|
40
42
|
@xmpp_comm.on_connected do |c|
|
41
43
|
t_name = SecureRandom.uuid
|
42
44
|
# TODO This format is different to AMQP
|
@@ -46,6 +48,7 @@ describe "Using XMPP communicator" do
|
|
46
48
|
end
|
47
49
|
|
48
50
|
it "must allow you to create a new pubsub topic" do
|
51
|
+
skip
|
49
52
|
@xmpp_comm.on_connected do |c|
|
50
53
|
t_name = SecureRandom.uuid.to_sym
|
51
54
|
c.create_topic(t_name)
|
@@ -30,6 +30,7 @@ describe OmfCommon::Comm::XMPP::Topic do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "must allow you to subscribe/unsubscribe to a new pubsub topic" do
|
33
|
+
skip
|
33
34
|
@xmpp_comm.on_connected do |c|
|
34
35
|
t_name = SecureRandom.uuid.to_sym
|
35
36
|
c.subscribe(t_name) do |topic|
|
@@ -43,6 +44,7 @@ describe OmfCommon::Comm::XMPP::Topic do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
it "must allow you to send and monitor messages" do
|
47
|
+
skip
|
46
48
|
@xmpp_comm.on_connected do |c|
|
47
49
|
t_name = SecureRandom.uuid.to_sym
|
48
50
|
c.subscribe(t_name) do |topic|
|
@@ -38,12 +38,6 @@ describe OmfCommon::Comm do
|
|
38
38
|
@topic.expects(:on_subscribed)
|
39
39
|
@abstract_comm.subscribe(:bob) { 'do nothing' }
|
40
40
|
end
|
41
|
-
|
42
|
-
it "must be able to publish message" do
|
43
|
-
@abstract_comm.stubs(:create_topic).returns(@topic)
|
44
|
-
@topic.expects(:publish)
|
45
|
-
@abstract_comm.publish(:bob, 'message')
|
46
|
-
end
|
47
41
|
end
|
48
42
|
|
49
43
|
describe 'when initialised with a pubsub implementation' do
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.0
|
4
|
+
version: 6.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NICTA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.5.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.5.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: evented-spec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,9 +319,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
319
319
|
version: 1.9.3
|
320
320
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
321
321
|
requirements:
|
322
|
-
- - ! '
|
322
|
+
- - ! '>='
|
323
323
|
- !ruby/object:Gem::Version
|
324
|
-
version:
|
324
|
+
version: '0'
|
325
325
|
requirements: []
|
326
326
|
rubyforge_project: omf_common
|
327
327
|
rubygems_version: 2.4.2
|