service_mesh_nats 0.5.1 → 0.6.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 +4 -4
- data/README.md +22 -12
- data/lib/service_mesh_nats/runtime.rb +2 -4
- data/lib/service_mesh_nats/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 683e607b098b1fd2c8a5aa3d2d89182658f2cc7271523456f4d0c50879a2748f
|
|
4
|
+
data.tar.gz: 0202c5b52d82746c1ecf86204efc29326c64f1b5edf60bcb6052c538bc26bed5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 423a075d243dcc467dc0208a5c5fdb2881c70c03af0c602f48ce0b461a19e2efb08fa68158122724a74cdbecac04e105b459eb49ba492d9ec9b7315f3fa522ed
|
|
7
|
+
data.tar.gz: 7e63ac578689eecbe34d4b3ee8b1880868eb4d1e40d7ec27e994e0ff8bcb2e911be6ec72ffb301d8fdb203d209b4fc6ec08a89c8c4e6a1861ec30d67b2727519
|
data/README.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
# service-mesh-nats-ruby
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[Service Mesh API Specification](https://github.com/Paymentbox-com/service-mesh-api)
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
service-mesh-nats-ruby is the Ruby implementation of the
|
|
4
|
+
[Service Mesh API Specification](https://github.com/Paymentbox-com/service-mesh-api)
|
|
5
|
+
over NATS. It implements the Ruby contract in the `service_mesh` gem, from
|
|
6
|
+
[service-mesh-ruby](https://github.com/Paymentbox-com/service-mesh-ruby), on
|
|
7
|
+
top of the `nats-pure` client.
|
|
8
|
+
|
|
9
|
+
The `ServiceMeshNats` module provides:
|
|
10
|
+
* `Client`, which implements the contract's `Client` over one NATS connection
|
|
11
|
+
* `Runtime`, which implements the contract's `Runtime` on a `Client`'s connection
|
|
12
|
+
* the configuration keys it reads
|
|
13
|
+
* the errors it defines
|
|
14
|
+
|
|
15
|
+
The contract types it works with, such as `ServiceMesh::Target`,
|
|
16
|
+
`ServiceMesh::Message`, `ServiceMesh::Endpoint`, and `ServiceMesh::Subscriber`,
|
|
17
|
+
come from the `service_mesh` gem.
|
|
7
18
|
|
|
8
19
|
## Install
|
|
9
20
|
|
|
@@ -12,7 +23,7 @@ This gem depends on the contract types and errors in [service-mesh-ruby](https:/
|
|
|
12
23
|
gem "service_mesh_nats"
|
|
13
24
|
```
|
|
14
25
|
|
|
15
|
-
Requires Ruby 3.3 or newer and a reachable NATS server.
|
|
26
|
+
Requires Ruby 3.3 or newer and a reachable NATS server. The gem depends on
|
|
16
27
|
`service_mesh` and `nats-pure`.
|
|
17
28
|
|
|
18
29
|
## Usage
|
|
@@ -49,15 +60,14 @@ reply = client.request(ServiceMesh::Message.new(target: echo, payload: "hi"))
|
|
|
49
60
|
client.publish(ServiceMesh::Message.new(target: created, payload: "order 42"))
|
|
50
61
|
```
|
|
51
62
|
|
|
52
|
-
The client is the runtime's connection. `runtime.client` returns it
|
|
53
|
-
`runtime.stop` closes it. A process that only requests and
|
|
54
|
-
|
|
55
|
-
`
|
|
56
|
-
built with.
|
|
63
|
+
The client is the runtime's connection. `runtime.client` returns it in every
|
|
64
|
+
state, and `runtime.stop` closes it. A process that only requests and publishes
|
|
65
|
+
builds a client itself and calls `close` when done. `runtime.service_map` and
|
|
66
|
+
`client.service_map` return the map the client was built with.
|
|
57
67
|
|
|
58
68
|
## Documentation
|
|
59
69
|
|
|
60
70
|
- [Examples](docs/examples.md): a server process, a call-only client process, and consumer groups
|
|
61
|
-
- [Public API](docs/public-api.md):
|
|
62
|
-
- [
|
|
71
|
+
- [Public API](docs/public-api.md): every public constant and method in `ServiceMeshNats`
|
|
72
|
+
- [Transport Specific Implementation](docs/transport-specific-implementation.md): subjects, configuration, metadata, delivery, handler failure, timeouts, concurrency, lifecycle, and errors
|
|
63
73
|
- [Development](docs/development.md): the recipes and the tests
|
|
@@ -45,8 +45,8 @@ module ServiceMeshNats
|
|
|
45
45
|
# Subscribes every binding on the client's connection and begins
|
|
46
46
|
# receiving. Raises AlreadyStarted on a running runtime, Stopped after
|
|
47
47
|
# stop, and Closed when the client has been closed. A failure while
|
|
48
|
-
# subscribing
|
|
49
|
-
# through.
|
|
48
|
+
# subscribing or flushing unsubscribes what was subscribed, leaves the
|
|
49
|
+
# runtime and the client as they were, and passes through.
|
|
50
50
|
def start
|
|
51
51
|
@lock.synchronize do
|
|
52
52
|
raise AlreadyStarted if @state == :running
|
|
@@ -66,8 +66,6 @@ module ServiceMeshNats
|
|
|
66
66
|
rescue => e
|
|
67
67
|
subs.each { |s| s.unsubscribe rescue nil } # rubocop:disable Style/RescueModifier
|
|
68
68
|
pool.kill
|
|
69
|
-
@client.close
|
|
70
|
-
@state = :stopped
|
|
71
69
|
raise e
|
|
72
70
|
end
|
|
73
71
|
|