dapr 0.1.18 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.adoc +62 -10
- 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: 8df47b206023dca8719858a4804d26d2ebafa509bddb478b91bede1cc4218d62
|
4
|
+
data.tar.gz: 950c92173973547e2865de8ea19733a0cd01c2740871e12c2eea3dc7de1c58b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b71595b5f08a7c41c16f2dfb1c77dfd2d82e45a3d18a87a1cc2ef69a164d9eb481af8e4e024d4c7de7dc11796d3db4de135c3ba9d06aa07fae9bae7d14a25a4
|
7
|
+
data.tar.gz: abda725498346865e3adc1d8102bb1ceee7dcc08170b5d409a0e5b29fc81b50817cd80f3aac71fc9338abfcd25700f992a32248833127edd3a354bd522c61b3c
|
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,27 +61,65 @@ 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
|
54
|
-
send each message to in the topic(s) that you specify. This unique
|
68
|
+
send each message to in the topic(s) that you specify. This unique approach allows you to
|
55
69
|
focus on the business logic of your service, rather than the plumbing of message consumption.
|
56
70
|
|
57
71
|
[source,ruby]
|
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