spsclient_m2m 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c541421327f89a85b16b1e5fcde1884b09981fa4
4
+ data.tar.gz: d2a8231e59cecea8b6a4db1518a73920f513fa9f
5
+ SHA512:
6
+ metadata.gz: 2c23718ee69d10c0bf4935859cd999559b83ab6444702b4d5013872d1f7d3d10ec66394bd946aff1f99cbf34492e7332c926fc928db0d6b8de38f2afeaf1e295
7
+ data.tar.gz: d4133b0791590832a1f51df431d7cf760e484b12fc6683952164cc878e9ecc45bf3484424a04a6fc12e7b3c0ccc58522263ee4ff81f8052cdad4369bd1afc5b1
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ z9(��-��o�_j����H=����—��n��"B��\W��$�̝�ҡU��x�"<M-��j2X.�y�!��*�)���=�WP����Xk��QD��ܱj�y�]�[Ǿ������2��2+Z�֔�vj�����eS�/�o�4O�G�s�:d����b
2
+
3
+ �0��Ց~����,ㅰz"p��v�z��J�0�y������|
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: spsclient_m2m.rb
4
+
5
+
6
+ require 'polyrex'
7
+ require 'spstrigger_execute'
8
+ require 'websocket-eventmachine-client'
9
+
10
+
11
+ class SPSClientM2M
12
+
13
+ def initialize(rws, sps_keywords_url, px_url, logfile: nil, \
14
+ sps: {host: 'sps', port: '59000'})
15
+
16
+ @log = Logger.new(logfile,'daily') if logfile
17
+ @rws = rws
18
+ @sps_address = "%s:%s" % [sps[:host], sps[:port]]
19
+
20
+ reg = @rws.services['registry']
21
+
22
+ px = Polyrex.new px_url
23
+
24
+ @ste = SPSTriggerExecute.new sps_keywords_url, reg, px
25
+
26
+ end
27
+
28
+ def run()
29
+
30
+ rws = @rws
31
+ ste = @ste
32
+ sps_address = @sps_address
33
+
34
+ EM.run do
35
+
36
+ ws = WebSocket::EventMachine::Client.connect(:uri => 'ws://' + sps_address)
37
+
38
+ ws.onopen do
39
+ puts "Client connected"
40
+ end
41
+
42
+ ws.onmessage do |msg, type|
43
+
44
+ log 'msg : ' + msg.inspect
45
+ topic, raw_message = msg.split(/\s*:\s*/,2)
46
+ puts "[%s] SPS M2M kywrd lstnr INFO %s: %s" % \
47
+ [Time.now.strftime("%D %H:%M"), topic, raw_message]
48
+
49
+ a = ste.mae topic, raw_message
50
+ log 'a: ' + a.inspect
51
+
52
+ # obj is the DRb object, r is the result from find_match,
53
+ # a is the Dynarex lookup array, ws is the websocket.
54
+
55
+ if a.length > 0 then
56
+
57
+ h = {
58
+
59
+ rse: ->(x){
60
+
61
+ job = x.shift[/\/\/job:(.*)/,1]
62
+ package_path = x.shift
63
+ package = package_path[/([^\/]+)\.rsf$/,1]
64
+
65
+ log "job: %s path: %s package: %s" % [job, package_path, package]
66
+ rws.run_job package, job, {}, args=x, package_path: package_path
67
+ },
68
+ sps: ->(x){ ws.send x },
69
+ ste: ->(x){ ste.run x }
70
+ }
71
+
72
+ end
73
+
74
+
75
+ EM.defer { a.each {|type, x| h[type].call x} }
76
+ end
77
+
78
+ ws.onclose do
79
+ puts "Client disconnected"
80
+ end
81
+
82
+ EventMachine.next_tick do
83
+ ws.send 'subscribe to topic: #'
84
+ ws.send 'rse_info: spsclient_m2m connected'
85
+ end
86
+
87
+ EventMachine.error_handler{ |e|
88
+ puts "Error raised during event loop: #{e.message}"
89
+
90
+ }
91
+
92
+ end
93
+
94
+ end
95
+
96
+ private
97
+
98
+ def log(s)
99
+ @log.debug(s) if @log
100
+ end
101
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spsclient_m2m
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCC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mwdXmtKNfmyk+MKF55EvD4o
29
+ 6qi36tGmwPTKmHxRXRPyu+SXuuWbW2KekCG+dpsWMo+6/YdVY9kheiSJNHeihLxw
30
+ q1FrbfkV0cBE9XEfj8uaMqjxAHQXU3NXgcUerAnGdaL60cCQcQBL2Dq7cyjY1SL4
31
+ T6T1zA114xGtNySLHgysbWolmPnuWTcou0g6bzQj4ZznKivneYKmiIOaBL9xkz+D
32
+ OoIGmnbBwLZGIw==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-03-09 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: polyrex
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.0'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.6
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.6
56
+ - !ruby/object:Gem::Dependency
57
+ name: spstrigger_execute
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.3'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.3.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.3'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.0
76
+ - !ruby/object:Gem::Dependency
77
+ name: websocket-eventmachine-client
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.1.0
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '1.0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 1.1.0
96
+ description:
97
+ email: james@r0bertson.co.uk
98
+ executables: []
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - lib/spsclient_m2m.rb
103
+ homepage: https://github.com/jrobertson/spsclient_m2m
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: The SPSClient_M2M gem is designed to run as a service within the RSF_Services
127
+ gem
128
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ (D3w��[O���0�zl?��n\� �����[�}sq��h�ȶۢ�`����<��Go[Ү� I��8$����3�ג�H���m��7/���w֌���x�&�k‚�O;iD�@Bz'i� �I����|��UI�Y��g��$t�.�vBj���<e�h�D6]�:�᷌z]�.9�r�l�C������c�fn�ťʖ���gh���O%�u�.���Cy�o;޶�Ӡ��oI��F�o�/{zHR� J�L���g>