remote_service 0.1.1
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 +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +14 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +21 -0
- data/README.md +71 -0
- data/Rakefile +10 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +28 -0
- data/examples/client.rb +19 -0
- data/examples/service_a.rb +10 -0
- data/examples/service_b.rb +10 -0
- data/lib/remote_service/base.rb +23 -0
- data/lib/remote_service/call.rb +40 -0
- data/lib/remote_service/connector/nats.rb +62 -0
- data/lib/remote_service/errors.rb +13 -0
- data/lib/remote_service/proxy.rb +19 -0
- data/lib/remote_service/queue.rb +74 -0
- data/lib/remote_service/service.rb +36 -0
- data/lib/remote_service/util/lock.rb +25 -0
- data/lib/remote_service/version.rb +3 -0
- data/lib/remote_service.rb +32 -0
- data/remote_service.gemspec +29 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4dd7830f2ff048b0348942c4da955bf2acd73188
|
4
|
+
data.tar.gz: ab29fdb9efff35d9bbf4bb2187329668abcabcc8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b7d5ce88b8d965819819136582595a6cda5ae72dc337b1a6b3b5b4844bb021bebb8d593d106d25c802445ae1ef26d222e15756f4af963aca7d5f1fbcb590a1a
|
7
|
+
data.tar.gz: 9fe38ebaec53b369eba922d1aa93612eea864074d4fcd5745a33e3a44db6e47e55d673c5f63576e8e291037d7129d480d516f38e0f1e586ded2b4c66881d95d5
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
remote_service (0.1.0)
|
5
|
+
msgpack (~> 1.0)
|
6
|
+
nats (~> 0.8.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
eventmachine (1.2.0.1)
|
12
|
+
metaclass (0.0.4)
|
13
|
+
minitest (5.9.0)
|
14
|
+
mocha (1.1.0)
|
15
|
+
metaclass (~> 0.0.1)
|
16
|
+
msgpack (1.0.0)
|
17
|
+
nats (0.8.0)
|
18
|
+
eventmachine (~> 1.2, >= 1.2.0)
|
19
|
+
rake (10.4.2)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (~> 1.12)
|
26
|
+
minitest (~> 5.0)
|
27
|
+
mocha (~> 1.1)
|
28
|
+
rake (~> 10.0)
|
29
|
+
remote_service!
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
1.12.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# RemoteService 
|
2
|
+
|
3
|
+
Remote services made easy. This gem is basically RPC client/server implemented on top of awesome [NATS](http://nats.io/) project. Every service you want to use is exposed through class that extends `RemoteService::Proxy`. Service itself extends `RemoteService::Service` and should define all methods that you want to call from clients.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'remote_service'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install remote_service
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
First you need to start NATS cluster. This can be either single broker or n-node cluster. I've made easy for you to play with this gem, so all you need to do is install `Docker` and `Docker compose` (if you haven't yet) and run following command.
|
23
|
+
```
|
24
|
+
docker-compose up
|
25
|
+
```
|
26
|
+
|
27
|
+
First you need to define and run your service. Minimal service can be run with a following script where return value of each method will be sent back as a response.
|
28
|
+
```ruby
|
29
|
+
require "remote_service"
|
30
|
+
|
31
|
+
class ServiceA < RemoteService::Service
|
32
|
+
def all(count, keyword)
|
33
|
+
# exceptions raised here will raise RemoteService::Errors::RemoteCallError exception in client
|
34
|
+
count
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# NATS uses autodiscovery, so third broker will be added automatically
|
39
|
+
ServiceA.start(brokers: ['nats://127.0.0.1:4222', 'nats://127.0.0.1:5222'])
|
40
|
+
```
|
41
|
+
|
42
|
+
To call this service from remote machine, one need to define service proxy. Following script is an example of how can we execute remote call to the service defined above.
|
43
|
+
```ruby
|
44
|
+
require "remote_service"
|
45
|
+
|
46
|
+
RemoteService.connect(brokers: ['nats://127.0.0.1:4222', 'nats://127.0.0.1:6222'])
|
47
|
+
|
48
|
+
class ServiceA < RemoteService::Proxy
|
49
|
+
timeout 100 # optional, default value is 10ms
|
50
|
+
end
|
51
|
+
|
52
|
+
# non-blocking call
|
53
|
+
ServiceA.all(123, keyword: 'value') do |result, error|
|
54
|
+
puts result
|
55
|
+
end
|
56
|
+
sleep(0.1) # wait for non-blocking call to execute
|
57
|
+
|
58
|
+
# blocking call
|
59
|
+
# this will raise RemoteService::Errors::RemoteCallError if an error was raised in remote service
|
60
|
+
puts ServiceA.all(123, keyword: 'value')
|
61
|
+
```
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/marekgalovic/ruby-remote-service. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
66
|
+
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
71
|
+
|
data/Rakefile
ADDED
data/bin/setup
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
version: '2'
|
2
|
+
|
3
|
+
services:
|
4
|
+
nats_node_1:
|
5
|
+
image: nats:0.9.4
|
6
|
+
hostname: nats1
|
7
|
+
entrypoint: '/gnatsd -p 4222 -m 8888 -cluster nats://0.0.0.0:4248 -D'
|
8
|
+
ports:
|
9
|
+
- "4222:4222"
|
10
|
+
- "8888:8888"
|
11
|
+
|
12
|
+
nats_node_2:
|
13
|
+
image: nats:0.9.4
|
14
|
+
hostname: nats2
|
15
|
+
entrypoint: '/gnatsd -p 5222 -cluster nats://0.0.0.0:5248 -routes nats://nats1:4248 -D'
|
16
|
+
links:
|
17
|
+
- nats_node_1:nats1
|
18
|
+
ports:
|
19
|
+
- "5222:5222"
|
20
|
+
|
21
|
+
nats_node_3:
|
22
|
+
image: nats:0.9.4
|
23
|
+
hostname: nats3
|
24
|
+
entrypoint: '/gnatsd -p 6222 -cluster nats://0.0.0.0:6248 -routes nats://nats1:4248 -D'
|
25
|
+
links:
|
26
|
+
- nats_node_1:nats1
|
27
|
+
ports:
|
28
|
+
- "6222:6222"
|
data/examples/client.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'benchmark'
|
3
|
+
require "bundler/setup"
|
4
|
+
require "remote_service"
|
5
|
+
|
6
|
+
class ServiceA < RemoteService::Proxy
|
7
|
+
timeout 100
|
8
|
+
end
|
9
|
+
|
10
|
+
class ServiceB < RemoteService::Proxy
|
11
|
+
timeout 100
|
12
|
+
end
|
13
|
+
|
14
|
+
RemoteService.logger.level = Logger::DEBUG
|
15
|
+
RemoteService.connect(brokers: ['nats://127.0.0.1:4222', 'nats://127.0.0.1:5222', 'nats://127.0.0.1:6222'])
|
16
|
+
|
17
|
+
ServiceA.all(123, keyword: 'value')
|
18
|
+
ServiceB.users
|
19
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RemoteService
|
2
|
+
class Base
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def queue_name
|
6
|
+
"services.#{@queue ||= default_queue_name}"
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def queue(name)
|
12
|
+
@queue = name
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_queue_name
|
16
|
+
self.name.split(/::/).last.
|
17
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
18
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
19
|
+
tr("-", "_").downcase
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module RemoteService
|
2
|
+
class Call
|
3
|
+
attr_reader :queue, :action, :params, :timeout
|
4
|
+
|
5
|
+
def initialize(queue, action, params, timeout:)
|
6
|
+
@queue = queue
|
7
|
+
@action = action
|
8
|
+
@params = params
|
9
|
+
@timeout = (timeout || 10) / 1000.0
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(&block)
|
13
|
+
return call_service_synchronously if !block_given?
|
14
|
+
call_service(&block)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def call_service
|
20
|
+
RemoteService::Queue.instance.request(queue, {action: action, params: params}) do |response|
|
21
|
+
yield(response['result'], response['error'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def call_service_synchronously
|
26
|
+
lock = Util::Lock.new(timeout)
|
27
|
+
call_service do |response, error|
|
28
|
+
lock.unlock(response, error)
|
29
|
+
end
|
30
|
+
response, error = lock.wait
|
31
|
+
raise remote_error(error) if error
|
32
|
+
response
|
33
|
+
end
|
34
|
+
|
35
|
+
def remote_error(error)
|
36
|
+
RemoteService.logger.error("RPC_ERROR - SERVICE:[#{queue}] ACTION:[#{action}] ERROR:#{error}")
|
37
|
+
Errors::RemoteCallError.new(error['name'], error['message'], error['backtrace'])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'nats/client'
|
2
|
+
|
3
|
+
module RemoteService
|
4
|
+
module Connector
|
5
|
+
class Nats
|
6
|
+
attr_reader :brokers
|
7
|
+
|
8
|
+
def initialize(brokers:)
|
9
|
+
@brokers = brokers
|
10
|
+
end
|
11
|
+
|
12
|
+
def start(&block)
|
13
|
+
return connection_thread if !block_given?
|
14
|
+
connect(&block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def stop
|
18
|
+
NATS.stop
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish(to_queue, message)
|
22
|
+
NATS.publish(to_queue, message)
|
23
|
+
end
|
24
|
+
|
25
|
+
def request(to_queue, message, &block)
|
26
|
+
NATS.request(to_queue, message, &block)
|
27
|
+
end
|
28
|
+
|
29
|
+
def subscribe(service_queue, &block)
|
30
|
+
NATS.subscribe(service_queue, queue: service_queue, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :connection
|
36
|
+
|
37
|
+
def connect
|
38
|
+
NATS.start(servers: @brokers) do |connection|
|
39
|
+
RemoteService.logger.info "CONNECTED: #{connection.connected_server}"
|
40
|
+
RemoteService.logger.info "SERVERS IN POOL: #{connection.server_pool.count}"
|
41
|
+
connection.on_reconnect do
|
42
|
+
RemoteService.logger.info "RECONNECT, NEW_NODE: #{connection.connected_server}"
|
43
|
+
end
|
44
|
+
connection.on_disconnect do |reason|
|
45
|
+
RemoteService.logger.info "DISCONNECTED: #{reason}"
|
46
|
+
end
|
47
|
+
yield(connection)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def connection_thread
|
52
|
+
lock = Util::Lock.new
|
53
|
+
Thread.new do
|
54
|
+
connect do |connection|
|
55
|
+
lock.unlock(connection)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
lock.wait
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RemoteService
|
2
|
+
class Proxy < Base
|
3
|
+
class << self
|
4
|
+
def method_missing(method_name, *args, &block)
|
5
|
+
service_call(method_name, args, &block)
|
6
|
+
end
|
7
|
+
|
8
|
+
def timeout(time)
|
9
|
+
@timeout = time
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def service_call(action, payload, &block)
|
15
|
+
Call.new(self.queue_name, action, payload, timeout: @timeout).run(&block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require 'singleton'
|
3
|
+
require 'msgpack'
|
4
|
+
|
5
|
+
module RemoteService
|
6
|
+
class Queue
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def connect(brokers, &block)
|
10
|
+
@conn = RemoteService::Connector::Nats.new(brokers)
|
11
|
+
@conn.start(&block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def service(service_handler, workers=16)
|
15
|
+
@service_handler = service_handler
|
16
|
+
@workers = workers
|
17
|
+
start_service_subscriber
|
18
|
+
end
|
19
|
+
|
20
|
+
def request(queue, payload)
|
21
|
+
RemoteService.logger.debug "REQUEST - SERVICE:[#{queue}] PAYLOAD:[#{payload}]"
|
22
|
+
sent_at = Time.now.utc
|
23
|
+
@conn.request(queue, encode(payload)) do |response|
|
24
|
+
data = decode(response)
|
25
|
+
response_time = (Time.now.utc - sent_at)*1000
|
26
|
+
RemoteService.logger.debug "RESPONSE - SERVICE:[#{queue}] PAYLOAD:[#{data}] TIME:[#{response_time}ms]"
|
27
|
+
yield(data)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def publish(queue, payload)
|
32
|
+
@conn.publish(queue, encode(payload))
|
33
|
+
end
|
34
|
+
|
35
|
+
def stop
|
36
|
+
@conn.stop
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def start_service_subscriber
|
42
|
+
RemoteService.logger.debug "SERVICE QUEUE: #{service_queue_name}"
|
43
|
+
@conn.subscribe(service_queue_name) do |request, reply_to|
|
44
|
+
begin
|
45
|
+
payload = decode(request)
|
46
|
+
RemoteService.logger.debug "FETCHED - REPLY_TO:[#{reply_to}] PAYLOAD:[#{payload}]"
|
47
|
+
@service_handler.handle(payload, reply_to)
|
48
|
+
rescue => e
|
49
|
+
RemoteService.logger.error(e)
|
50
|
+
Queue.instance.publish(
|
51
|
+
reply_to,
|
52
|
+
{result: nil, error: {name: e.class.name, message: e.message, backtrace: e.backtrace}},
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def service?
|
59
|
+
@service_handler != nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def service_queue_name
|
63
|
+
@service_handler.class.queue_name if @service_handler
|
64
|
+
end
|
65
|
+
|
66
|
+
def encode(payload)
|
67
|
+
MessagePack.pack(payload)
|
68
|
+
end
|
69
|
+
|
70
|
+
def decode(payload)
|
71
|
+
MessagePack.unpack(payload)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module RemoteService
|
4
|
+
class Service < Base
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
def handle(payload, reply_to)
|
8
|
+
result = method(payload['action'].to_sym).call(*prepare_params(payload['params']))
|
9
|
+
RemoteService.logger.debug "RESULT - ACTION:[#{payload['action']}] REPLY_TO:[#{reply_to}] PARAMS:[#{payload['params']}] RESULT:[#{result}]"
|
10
|
+
respond_with_result(reply_to, result)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def respond_with_result(reply_to, result)
|
16
|
+
Queue.instance.publish(reply_to, {result: result})
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare_params(params)
|
20
|
+
params.map { |param| param.is_a?(Hash) ? sym_keys(param) : param }
|
21
|
+
end
|
22
|
+
|
23
|
+
def sym_keys(params)
|
24
|
+
params.map { |k, v| [k.to_sym, v] }.to_h
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def start(brokers, workers=16)
|
29
|
+
queue = Queue.instance
|
30
|
+
queue.connect(brokers) do
|
31
|
+
queue.service(self.instance, workers)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
3
|
+
module RemoteService
|
4
|
+
module Util
|
5
|
+
class Lock
|
6
|
+
def initialize(timeout=0)
|
7
|
+
@mutex = Mutex.new
|
8
|
+
@condition = ConditionVariable.new
|
9
|
+
@timeout = timeout
|
10
|
+
end
|
11
|
+
|
12
|
+
def unlock(*return_value)
|
13
|
+
@return_value = *return_value
|
14
|
+
@mutex.synchronize{ @condition.signal }
|
15
|
+
end
|
16
|
+
|
17
|
+
def wait
|
18
|
+
Timeout.timeout(@timeout) do
|
19
|
+
@mutex.synchronize{ @condition.wait(@mutex) }
|
20
|
+
@return_value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "remote_service/version"
|
2
|
+
require "remote_service/errors"
|
3
|
+
require "remote_service/util/lock"
|
4
|
+
require "remote_service/connector/nats"
|
5
|
+
require "remote_service/queue"
|
6
|
+
require "remote_service/call"
|
7
|
+
require "remote_service/base"
|
8
|
+
require "remote_service/service"
|
9
|
+
require "remote_service/proxy"
|
10
|
+
require 'logger'
|
11
|
+
|
12
|
+
module RemoteService
|
13
|
+
extend self
|
14
|
+
attr_writer :logger
|
15
|
+
|
16
|
+
def connect(brokers, &block)
|
17
|
+
queue = Queue.instance
|
18
|
+
queue.connect(brokers, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def disconnect
|
22
|
+
Queue.instance.stop
|
23
|
+
end
|
24
|
+
|
25
|
+
def logger
|
26
|
+
@logger ||= begin
|
27
|
+
logger = Logger.new(STDOUT)
|
28
|
+
logger.level = Logger::INFO
|
29
|
+
logger
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'remote_service/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "remote_service"
|
8
|
+
spec.version = RemoteService::VERSION
|
9
|
+
spec.authors = ["Marek Galovic"]
|
10
|
+
spec.email = ["galovic.galovic@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Dead-simple ruby RPC}
|
13
|
+
spec.description = %q{NATS based client/server implementation that allows you to easily call remote services.}
|
14
|
+
spec.homepage = "https://github.com/marekgalovic/ruby-remote-service"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'nats', '~> 0.8.0'
|
23
|
+
spec.add_runtime_dependency 'msgpack', '~> 1.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
28
|
+
spec.add_development_dependency 'mocha', '~> 1.1'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remote_service
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marek Galovic
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nats
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: msgpack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mocha
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.1'
|
97
|
+
description: NATS based client/server implementation that allows you to easily call
|
98
|
+
remote services.
|
99
|
+
email:
|
100
|
+
- galovic.galovic@gmail.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- Gemfile.lock
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/setup
|
113
|
+
- docker-compose.yml
|
114
|
+
- examples/client.rb
|
115
|
+
- examples/service_a.rb
|
116
|
+
- examples/service_b.rb
|
117
|
+
- lib/remote_service.rb
|
118
|
+
- lib/remote_service/base.rb
|
119
|
+
- lib/remote_service/call.rb
|
120
|
+
- lib/remote_service/connector/nats.rb
|
121
|
+
- lib/remote_service/errors.rb
|
122
|
+
- lib/remote_service/proxy.rb
|
123
|
+
- lib/remote_service/queue.rb
|
124
|
+
- lib/remote_service/service.rb
|
125
|
+
- lib/remote_service/util/lock.rb
|
126
|
+
- lib/remote_service/version.rb
|
127
|
+
- remote_service.gemspec
|
128
|
+
homepage: https://github.com/marekgalovic/ruby-remote-service
|
129
|
+
licenses:
|
130
|
+
- MIT
|
131
|
+
metadata: {}
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
requirements: []
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 2.5.1
|
149
|
+
signing_key:
|
150
|
+
specification_version: 4
|
151
|
+
summary: Dead-simple ruby RPC
|
152
|
+
test_files: []
|