sps-sub-ping 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77160431d9636dd10ed975320c737f428e6961c3
4
+ data.tar.gz: d792c14d5423f79a61b869ab77b04aa3225edfaa
5
+ SHA512:
6
+ metadata.gz: 9f5f784448a2dba758606cb376c9be399bce86f89df5ab72e6c05677b0d2b88e2cf7c7e05a2b78df49675d8ad9614917f183e3b8446693101e7a098fff22555f
7
+ data.tar.gz: b63ec52d0d0dbb2baafdf39b06dccaf728834e508c568c509eae65b5ca94b7f91d17719b294aa65ace828397a357147dfca30428631bdbadbee929ed3344c6d5
Binary file
Binary file
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: sps-sub-ping.rb
4
+
5
+
6
+ require 'sps-sub'
7
+ require 'sps-pub'
8
+
9
+
10
+ class SPSSubPing < SPSSub
11
+
12
+ def initialize(port: '59000', host: nil, address: nil,
13
+ topic: 'system/watchdog/ping', identifier: nil)
14
+
15
+ raise 'SPSSubPing: identifier must be provided' unless identifier
16
+
17
+ @host = host || address || 'localhost'
18
+ @port = port.to_s
19
+ @topic, @identifier = topic, identifier
20
+
21
+ super(host: @host, port: port)
22
+
23
+ @pub = SPSPub.new address: host, port: port
24
+
25
+ end
26
+
27
+ def start()
28
+ subscribe(topic: @topic)
29
+ end
30
+
31
+ def onmessage(msg)
32
+ @pub.notice @topic.sub(/ping$/,'pong') + ": #{@identifier} responded"
33
+ end
34
+ end
35
+
36
+ if __FILE__ == $0 then
37
+
38
+ host, identifier = ARGV
39
+ sp = SPSSubPing.new host: host, identifier: identifier
40
+ sp.start
41
+
42
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sps-sub-ping
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors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Q2QUSSjO4CvJStGtcQvx2sP+QIMfeiNICmF3mL+HbceP6sGe9
28
+ sTnmZZWrEHpx6X0h6pXFPOSLlkAqatBMsalhA2NIftu6LjMcbZ4x44Y9rDpYZrae
29
+ ImGZplPHf4Z2IInGss3jK3zCX9Yt68haftXX4Cu/W0nVuO8VkLgwaSDWQIeAZ6XK
30
+ 9kEZxCiR5Lh8Ge9H8Iq4g/AaznJ/aMP/ZG6++RSNZ2GyjZvubm0R/WgBA5QwUH+P
31
+ HIdI8feXBWasizL/WYGF5jl/9uXq7cewFbCjDiY++kM/UJhQSzI9OQaVzzkW3MGK
32
+ zAtuwpdp/3k5XQ==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-06-22 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: sps-pub
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.0
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: sps-sub
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.2'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.2.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.2'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.2.0
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/sps-sub-ping.rb
83
+ homepage: https://github.com/jrobertson/sps-sub-ping
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.4.6
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Embed within a service for responding to a SimplePubSub ping message
107
+ test_files: []
Binary file