dapr 0.1.16 → 0.1.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69ca20629b254d2447082c3c9d1fec6d5602e8ee68ee302c0b7fc83d6e70b87e
4
- data.tar.gz: 93daa2cf31f7d3516b3400d62070ac5588f2482ace22146c5e2e30d5fae5cc29
3
+ metadata.gz: 799c05f8d8605bc143ba8a423cbcf141fb3b42f157efec50171fd071064b84e9
4
+ data.tar.gz: 80d22d6b23ee2a1b035133702210d8fb9575a3cd7f56d4d6f9d80e0e9d61c3c0
5
5
  SHA512:
6
- metadata.gz: 9db792b6fa9cea3b8ab0943c88ae981544421dcbfd068ec67d51652170d3c8df9fdcb4969c64b64d362ef722615c377e39cd1d99fad822f629259440b24612f3
7
- data.tar.gz: 753e6e650e42d85f2cb80fbda2b08d39fe8e6e59d7a624956f96234494113ad4cc1b66f2fa07f42a4824f5e4ead4ce047a26440f568259d0e449947f7807460f
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.
@@ -11,7 +11,7 @@ module Rubyists
11
11
  class Subscriber
12
12
  include SemanticLogger::Loggable
13
13
 
14
- attr_reader(:service_proto, :runtime_proto, :pubsub_name, :topics, :event_handler)
14
+ attr_reader(:service_proto, :runtime_proto, :pubsub_name, :topics, :handler)
15
15
 
16
16
  def initialize(pubsub_name:,
17
17
  topics:,
data/lib/dapr/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Dapr
5
- VERSION = '0.1.16'
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.16
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