event_store_client 0.2.4 → 0.2.5
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/lib/event_store_client/broker.rb +1 -1
- data/lib/event_store_client/event.rb +2 -2
- data/lib/event_store_client/serializer/json.rb +2 -0
- data/lib/event_store_client/store_adapter/api/client.rb +1 -1
- data/lib/event_store_client/store_adapter/in_memory.rb +2 -2
- data/lib/event_store_client/subscriptions.rb +1 -1
- data/lib/event_store_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daaf4a7e189d14224fa8b520345b9108f6c9c02316d57742d599b3fe5fb15e22
|
4
|
+
data.tar.gz: 9eb7350e33cd14b7e9aff5ed2d8cf313838b6fe1df739ba5c4348111f18ec323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 803a1ac900741c28a9437135e48343d015eec4d55c3b1df5d536575bed13341f276aa85d24cb177cdf376284b1be7a0220b8b1bdde4bab558481b39f6ae930a4
|
7
|
+
data.tar.gz: 0fa249206dcbe74719fae1ba82e85de615d332cd82dc69d890154839e2fcccc7e6feb4269afc94fb9d46156816582a71a71afe364767c005e6ac101545c4b6e8
|
@@ -4,7 +4,7 @@ module EventStoreClient
|
|
4
4
|
class Broker
|
5
5
|
def call(subscriptions)
|
6
6
|
subscriptions.each do |subscription|
|
7
|
-
res = connection.consume_feed(subscription.stream, subscription.name) || []
|
7
|
+
res = connection.consume_feed(subscription.stream, subscription.name) || { events: [] }
|
8
8
|
next if res[:events].none?
|
9
9
|
res[:events].each { |event| subscription.subscriber.call(event) }
|
10
10
|
connection.ack(res[:ack_uri])
|
@@ -9,8 +9,8 @@ module EventStoreClient
|
|
9
9
|
attribute :id, Types::Strict::String.optional.default(nil)
|
10
10
|
attribute :type, Types::Strict::String
|
11
11
|
attribute :title, Types::Strict::String.optional.default(nil)
|
12
|
-
attribute :data, Types::
|
13
|
-
attribute :metadata, Types::
|
12
|
+
attribute :data, Types::Coercible::String.default('{}')
|
13
|
+
attribute :metadata, Types::Coercible::String.default('{}')
|
14
14
|
|
15
15
|
private
|
16
16
|
|
@@ -13,7 +13,6 @@ module EventStoreClient
|
|
13
13
|
|
14
14
|
def append_to_stream(stream_name, events, expected_version: nil) # rubocop:disable Lint/UnusedMethodArgument,Metrics/LineLength
|
15
15
|
event_store[stream_name] = [] unless event_store.key?(stream_name)
|
16
|
-
|
17
16
|
[events].flatten.each do |event|
|
18
17
|
event_store[stream_name].unshift(
|
19
18
|
'eventId' => event.id,
|
@@ -145,11 +144,12 @@ module EventStoreClient
|
|
145
144
|
private
|
146
145
|
|
147
146
|
def deserialize_event(entry)
|
147
|
+
data = (entry['data'].is_a?(Hash) ? entry['data'].to_json.presence : entry['data']) || '{}'
|
148
148
|
event = EventStoreClient::Event.new(
|
149
149
|
id: entry['eventId'],
|
150
150
|
title: entry['title'],
|
151
151
|
type: entry['eventType'],
|
152
|
-
data:
|
152
|
+
data: data,
|
153
153
|
metadata: entry['isMetaData'] ? entry['metaData'] : '{}'
|
154
154
|
)
|
155
155
|
|
@@ -27,7 +27,7 @@ module EventStoreClient
|
|
27
27
|
def create_subscription(subscription)
|
28
28
|
# store position somewhere.
|
29
29
|
connection.join_streams(subscription.name, subscription.observed_streams)
|
30
|
-
connection.subscribe_to_stream(subscription.stream,
|
30
|
+
connection.subscribe_to_stream(subscription.stream, subscription.name)
|
31
31
|
end
|
32
32
|
|
33
33
|
attr_reader :connection, :subscriptions, :service
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_store_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Wilgosz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-schema
|