evt-consumer-event_store 0.1.0.2 → 0.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e90762ac55e5ce8035cb1c10f683fdf7203fbe45
4
- data.tar.gz: 5741856b20f5a0077ec98063524fcc82e65a3793
3
+ metadata.gz: 0b94ea341885393d6dec8741b6a3a5f01fbc0053
4
+ data.tar.gz: 0bfa655ea86e7b74dc444e696d13a2332b43a370
5
5
  SHA512:
6
- metadata.gz: 4853990b3d1b1c0792f37c3a4b54a229a6187a528e83774aee0d738ef2930ecde35f5ae22f2285ab5e5a23997cedae510040e4b73d1ef725bd170f147d4e5130
7
- data.tar.gz: adf4f3fdf5ccb2a6546a2ccf6f040eab2c95b90710b00a996579aadb02017dad880a855576e98248f3aae658546ffd426a1cb7805d6544ae531d4bffdf1c6219
6
+ metadata.gz: 64c7d5865f948d4e81ffe43a56e420e8dd0a53f7b8a343c5c39bb87d3786c5de4f9fac293f66483b1d46d9227fde7bd92b1c01c194ea4f47e31452758112b09b
7
+ data.tar.gz: 3e48509db49b9551e57e6e30bf5ae0e194c682f0f96d27369e6a8c6bb9a45dcb6c16df64b6a70cd43239da4aaefea712908b19edcdf745c6dfcfdd53010ae505
@@ -1,8 +1,6 @@
1
1
  require 'consumer'
2
2
  require 'messaging/event_store'
3
3
 
4
+ require 'consumer/event_store/copy_session'
4
5
  require 'consumer/event_store/event_store'
5
- require 'consumer/event_store/subscription'
6
6
  require 'consumer/event_store/position_store'
7
-
8
- Consumer::EventStore.activate
@@ -4,7 +4,6 @@ require 'consumer/event_store/controls/category'
4
4
  require 'consumer/event_store/controls/event_data'
5
5
  require 'consumer/event_store/controls/handle'
6
6
  require 'consumer/event_store/controls/position_stream'
7
- require 'consumer/event_store/controls/stream'
8
7
  require 'consumer/event_store/controls/stream_name'
9
8
 
10
9
  require 'consumer/event_store/controls/consumer'
@@ -0,0 +1,11 @@
1
+ module Consumer
2
+ module EventStore
3
+ module CopySession
4
+ def self.call(session)
5
+ copy = session.dup
6
+ copy.reconnect
7
+ copy
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,9 +1,5 @@
1
1
  module Consumer
2
2
  module EventStore
3
- def self.activate
4
- Subscription.activate
5
- end
6
-
7
3
  def self.included(cls)
8
4
  cls.class_exec do
9
5
  include Consumer
@@ -16,7 +12,7 @@ module Consumer
16
12
  long_poll_duration = Rational(cycle_timeout, 1000).ceil
17
13
 
18
14
  unless session.nil?
19
- get_session = ::EventStore::HTTP::Session.copy session
15
+ get_session = CopySession.(session)
20
16
  end
21
17
 
22
18
  EventSource::EventStore::HTTP::Get.configure(
@@ -28,7 +24,7 @@ module Consumer
28
24
 
29
25
  PositionStore.configure(
30
26
  self,
31
- stream,
27
+ stream_name,
32
28
  session: session,
33
29
  position_store: position_store
34
30
  )
@@ -10,9 +10,7 @@ module Consumer
10
10
  dependency :write, ::Messaging::EventStore::Write
11
11
 
12
12
  def self.build(stream_name, session: nil)
13
- stream = EventSource::Stream.build stream_name
14
-
15
- position_stream_name = StreamName.canonize stream.name
13
+ position_stream_name = StreamName.canonize stream_name
16
14
 
17
15
  instance = new position_stream_name
18
16
  EventSource::EventStore::HTTP::Session.configure instance, session: session
@@ -50,13 +48,17 @@ module Consumer
50
48
 
51
49
  module StreamName
52
50
  def self.canonize(stream_name)
53
- stream = EventSource::Stream.build stream_name
51
+ types = EventSource::StreamName.get_type_list stream_name
52
+ types = Array(types)
53
+
54
+ return stream_name if types.include? 'position'
55
+
56
+ types << 'position'
54
57
 
55
- return stream.name if stream.type == 'position'
58
+ entity_name = EventSource::StreamName.get_entity_name stream_name
59
+ id = EventSource::StreamName.get_id stream_name
56
60
 
57
- stream_name = "#{stream.category}:position"
58
- stream_name << "-#{stream.id}" if stream.id
59
- stream_name
61
+ EventSource::StreamName.stream_name entity_name, id, types: types
60
62
  end
61
63
  end
62
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-consumer-event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.2
4
+ version: 0.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-consumer
@@ -65,11 +65,10 @@ files:
65
65
  - lib/consumer/event_store/controls/event_data.rb
66
66
  - lib/consumer/event_store/controls/handle.rb
67
67
  - lib/consumer/event_store/controls/position_stream.rb
68
- - lib/consumer/event_store/controls/stream.rb
69
68
  - lib/consumer/event_store/controls/stream_name.rb
69
+ - lib/consumer/event_store/copy_session.rb
70
70
  - lib/consumer/event_store/event_store.rb
71
71
  - lib/consumer/event_store/position_store.rb
72
- - lib/consumer/event_store/subscription.rb
73
72
  homepage: https://github.com/eventide-project/consumer-event-store
74
73
  licenses:
75
74
  - MIT
@@ -1,7 +0,0 @@
1
- module Consumer
2
- module EventStore
3
- module Controls
4
- Stream = Consumer::Controls::Stream
5
- end
6
- end
7
- end
@@ -1,17 +0,0 @@
1
- module Consumer
2
- module EventStore
3
- module Subscription
4
- def self.activate
5
- Consumer::Subscription.class_exec do
6
- prepend StreamName
7
- end
8
- end
9
-
10
- module StreamName
11
- def stream_name
12
- EventSource::EventStore::HTTP::StreamName.canonize stream
13
- end
14
- end
15
- end
16
- end
17
- end