dapr 0.1.18 → 0.1.19
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.adoc +61 -9
- data/lib/dapr/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: 67d8484ce4365b192ba1756fa63085371e3224370b500a341a3ca2428581a0d3
|
4
|
+
data.tar.gz: c97c4d0b0e40940039f83dc041a81897b958086ba38d1a96b560d6e86dc25874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b19abf8c5983476ee14abfe9235fc84f34055a6ab49148bc9eef369a56ee20ca56e5f36e491e1de0e08c3c5cf85b3cb1bc4aad8696f442aaa21eb041f3e5f461
|
7
|
+
data.tar.gz: 565d9d2296feda65259fc5c0b30c5f462a6c44399ae97b7b3d1581751e541c9dc46fa9a1023bfe0924358b3ef870a5c857b17dd9b1263e03531606f8a286c47a
|
data/Readme.adoc
CHANGED
@@ -6,7 +6,17 @@
|
|
6
6
|
:caution-caption: :fire:
|
7
7
|
:warning-caption: :warning:
|
8
8
|
endif::[]
|
9
|
-
:dapr-building-block: https://docs.dapr.io/concepts/building-blocks-
|
9
|
+
:dapr-building-block: https://docs.dapr.io/concepts/building-blocks-concept/[Dapr Building Block]
|
10
|
+
:pubsub-block: https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/[Dapr Pub/Sub Building Block]
|
11
|
+
:state-block: https://docs.dapr.io/developing-applications/building-blocks/state-management/state-management-overview/[Dapr State Management Building Block]
|
12
|
+
:actors-block: https://docs.dapr.io/developing-applications/building-blocks/actors/actors-overview/[Dapr Actor Building Block]
|
13
|
+
:binding-block: https://docs.dapr.io/developing-applications/building-blocks/bindings/bindings-overview/[Dapr Binding Building Block]
|
14
|
+
:secret-block: https://docs.dapr.io/developing-applications/building-blocks/secrets/secrets-overview/[Dapr Secret Building Block]
|
15
|
+
:configuration-block: https://docs.dapr.io/developing-applications/building-blocks/configuration/configuration-api-overview/[Dapr Configuration Building Block]
|
16
|
+
:distributed-lock-block: https://docs.dapr.io/developing-applications/building-blocks/distributed-lock/distributed-lock-api-overview/[Dapr Distributed Lock Building Block]
|
17
|
+
:workflow-block: https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-overview/[Dapr Workflow Building Block]
|
18
|
+
:cryptography-block: https://docs.dapr.io/developing-applications/building-blocks/cryptography/cryptography-overview/[Dapr Cryptography Building Block]
|
19
|
+
|
10
20
|
|
11
21
|
== Overview
|
12
22
|
|
@@ -34,7 +44,11 @@ is a more opinionated and higher-level abstraction.
|
|
34
44
|
Each {dapr-building-block} is exposed as a class under the `Rubyists::Dapr::Client` or
|
35
45
|
`Rubyists::Dapr::Service` namespace.
|
36
46
|
|
37
|
-
===
|
47
|
+
=== Pub/Sub
|
48
|
+
|
49
|
+
Implementation of {pubsub-block}
|
50
|
+
|
51
|
+
==== Publish a message
|
38
52
|
|
39
53
|
[source,ruby]
|
40
54
|
----
|
@@ -47,7 +61,7 @@ publisher.publish('topic-name', { message: 'Hello, Dapr!', from: 'Ruby' })
|
|
47
61
|
<2> Create a new publisher for the `pubsub-name` pubsub component. This component must be defined in the Dapr runtime.
|
48
62
|
<3> Publish a message to the `topic-name` topic.
|
49
63
|
|
50
|
-
|
64
|
+
==== Subscribe to topics
|
51
65
|
|
52
66
|
Subscriptions in Dapr work a little different than you may be used to. Instead of subscribing to a topic
|
53
67
|
then looping through consumed messages, you define a fully-fledged service that Dapr will
|
@@ -58,16 +72,54 @@ focus on the business logic of your service, rather than the plumbing of message
|
|
58
72
|
----
|
59
73
|
require 'dapr/service/subscriber'
|
60
74
|
handler = ->(event) { puts "Got event: #{event}" } <1>
|
61
|
-
pubsub_name
|
62
|
-
|
63
|
-
sub.
|
75
|
+
pubsub_name = 'pubsub' <2>
|
76
|
+
topics = 'TOPIC-A' <3>
|
77
|
+
sub = Rubyists::Dapr::Service::Subscriber.new(pubsub_name:, topics:, handler:) <4>
|
78
|
+
sub.start! <5>
|
64
79
|
----
|
65
80
|
<1> Define a handler that will be called for each message received. `event` will be a `CloudEvents::Event` instance.
|
81
|
+
+
|
82
|
+
NOTE: The handler can be anything that responds to `#call`, such as a lambda, proc, or instance. Sky's the limit! (Dependency injection, anyone?)
|
83
|
+
+
|
66
84
|
<2> The name of the Dapr pubsub component this subscriber will utilize.
|
67
|
-
<3>
|
68
|
-
|
85
|
+
<3> The name of the topic(s) to subscribe to.
|
86
|
+
+
|
87
|
+
TIP: Multiple topics can be subscribed to simultaneously by passing an array of topic names to the `topics` argument.
|
88
|
+
+
|
89
|
+
<4> Create a new subscriber for the `pubsub` pubsub component, subscribing to the `TOPIC-A` topic.
|
90
|
+
<5> Start the subscriber. This will block the current thread and call the handler for each message received.
|
91
|
+
|
92
|
+
=== State Management
|
93
|
+
|
94
|
+
Implementation of {state-block}
|
95
|
+
|
96
|
+
=== Actors
|
97
|
+
|
98
|
+
Implementation of {actors-block}
|
99
|
+
|
100
|
+
=== Bindings
|
101
|
+
|
102
|
+
Implementation of {binding-block}
|
103
|
+
|
104
|
+
=== Secrets
|
105
|
+
|
106
|
+
Implementation of {secret-block}
|
107
|
+
|
108
|
+
=== Configuration
|
109
|
+
|
110
|
+
Implementation of {configuration-block}
|
111
|
+
|
112
|
+
=== Distributed Lock
|
113
|
+
|
114
|
+
Implementation of {distributed-lock-block}
|
115
|
+
|
116
|
+
=== Workflow
|
117
|
+
|
118
|
+
Implementation of {workflow-block}
|
119
|
+
|
120
|
+
=== Cryptography
|
69
121
|
|
70
|
-
|
122
|
+
Implementation of {cryptography-block}
|
71
123
|
|
72
124
|
== Development
|
73
125
|
|
data/lib/dapr/version.rb
CHANGED