dapr 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.adoc +22 -0
  3. data/lib/dapr/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13ce22237006e209c4a40049d3a95efc8f1ce02ac0381453a7c67c1171a9f212
4
- data.tar.gz: 8a0f1317ea37de9b33ccffdfb714d25e3ff946dc58562a783c6e082f638dc237
3
+ metadata.gz: 799c05f8d8605bc143ba8a423cbcf141fb3b42f157efec50171fd071064b84e9
4
+ data.tar.gz: 80d22d6b23ee2a1b035133702210d8fb9575a3cd7f56d4d6f9d80e0e9d61c3c0
5
5
  SHA512:
6
- metadata.gz: 6f871e883715d58a76177a9dbeb52a27ef43eeb5c49e71aaf0fbe844594b81ffaa5e760ae4ecf42fac5a3f1d2904f35194bcf309611aeb256d6b8b4543c4c6f1
7
- data.tar.gz: 5875a5e190d97170fb58fc60f8a99be4aeb85280a46d66794ae8e390f390dae3c2e9d82cbb3cf4a0d7c1ca13f9fbba38edd49380a5427817cd93fce20c7b202f
6
+ metadata.gz: 67dfca3d49d95550858b5dbd5c55c2dc890db598d7e1e06da3ce126cba3ec492ba18cce0f46e53b992475a22ef9557ac8eab6b48513bf8ab2bb46f4ae4e85087
7
+ data.tar.gz: 44402e4fdcbf197aeb5404254419f2caafd57e724ca648d3ad456fd85be71b2c24e25d313fa3e2fb06da8fedc53a97a5a109c01e4f4685c9f48f8d3dd456c0d3
data/Readme.adoc CHANGED
@@ -47,6 +47,28 @@ publisher.publish('topic-name', { message: 'Hello, Dapr!', from: 'Ruby' })
47
47
  <2> Create a new publisher for the `pubsub-name` pubsub component. This component must be defined in the Dapr runtime.
48
48
  <3> Publish a message to the `topic-name` topic.
49
49
 
50
+ === Subscribe to topics
51
+
52
+ Subscriptions in Dapr work a little different than you may be used to. Instead of subscribing to a topic
53
+ 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 appreach allows you to
55
+ focus on the business logic of your service, rather than the plumbing of message consumption.
56
+
57
+ [source,ruby]
58
+ ----
59
+ require 'dapr/service/subscriber'
60
+ handler = ->(event) { puts "Got event: #{event}" } <1>
61
+ pubsub_name: 'pubsub' <2>
62
+ sub = Rubyists::Dapr::Service::Subscriber.new(pubsub_name:, topics: 'TOPIC-A', handler: handler) <3>
63
+ sub.start! <4>
64
+ ----
65
+ <1> Define a handler that will be called for each message received. `event` will be a `CloudEvents::Event` instance.
66
+ <2> The name of the Dapr pubsub component this subscriber will utilize.
67
+ <3> Create a new subscriber for the `pubsub` pubsub component, subscribing to the `TOPIC-A` topic.
68
+ <4> Start the subscriber. This will block the current thread and call the handler for each message received.
69
+
70
+ TIP:: Multiple topics can be subscribed to simultaneously by passing an array of topic names to the `topics` argument.
71
+
50
72
  == Development
51
73
 
52
74
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/dapr/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Dapr
5
- VERSION = '0.1.17'
5
+ VERSION = '0.1.18'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tj (bougyman) Vanderpoel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-04-16 00:00:00.000000000 Z
12
+ date: 2024-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dapr-ruby