evt-consumer-postgres 0.2.0.3 → 0.2.1.0

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
  SHA1:
3
- metadata.gz: 5b9f2b54d10d5176eca114d8ffd2ee83ecbdd84b
4
- data.tar.gz: e5651e733914ef2423e61bb10a45c9e9be685230
3
+ metadata.gz: c19dea88a39fe0500f8a684c206ce88d7d93a555
4
+ data.tar.gz: cae6c5c45eef3630d8a684387fbf21892cfcd8d1
5
5
  SHA512:
6
- metadata.gz: c3fe6143013cf2d3ebede6dba317996a2417b15740e0fe4d2da5f4e2c13242c3a1ac8c5aa1e240bc4647dc1ba041d09633282c0e89d30e2f30beeb2353081939
7
- data.tar.gz: e7f3af871cabdec4c5e9f9ec0801b922420917e3eb329fe6506ca244c6c5f4785d77d5778b6a1b0d7e3b908c104d7bbba342e2157d9c73c9647c90bf836b829b
6
+ metadata.gz: 75d90f8a1a52debef360063e36bf59b99c574e5697ae3c353f52e3c0d5c38ed99cbe3193e694de8640c8fd1d4113ca51ace48490a41ee1a76dae4d4da1ff180d
7
+ data.tar.gz: 98c77244f0b4730303ba7c38768c35497a91215e8c894e62902e6e8d773d75e5fcb7c4f27ac3e4115e0315c8df7b196cc8499881d17fe0ada22e8d343c9dbc75
@@ -14,6 +14,12 @@ module Consumer
14
14
  logger.debug { message_data.data.pretty_inspect }
15
15
  end
16
16
  end
17
+
18
+ class Identifier
19
+ include ::Consumer::Postgres
20
+
21
+ identifier Controls::Identifier.example
22
+ end
17
23
  end
18
24
  end
19
25
  end
@@ -0,0 +1,7 @@
1
+ module Consumer
2
+ module Postgres
3
+ module Controls
4
+ Identifier = Consumer::Controls::Identifier
5
+ end
6
+ end
7
+ end
@@ -23,7 +23,7 @@ module Consumer
23
23
 
24
24
  position_type = 'position'
25
25
 
26
- MessageStore::StreamName.stream_name category, type: position_type
26
+ MessageStore::StreamName.stream_name(category, type: position_type)
27
27
  end
28
28
  end
29
29
  end
@@ -4,6 +4,7 @@ require 'message_store/postgres/controls'
4
4
 
5
5
  require 'consumer/postgres/controls/category'
6
6
  require 'consumer/postgres/controls/id'
7
+ require 'consumer/postgres/controls/identifier'
7
8
  require 'consumer/postgres/controls/message_data'
8
9
  require 'consumer/postgres/controls/position'
9
10
  require 'consumer/postgres/controls/position/store/updated'
@@ -2,18 +2,26 @@ module Consumer
2
2
  module Postgres
3
3
  class PositionStore
4
4
  module StreamName
5
- def self.get(stream_name)
6
- id = MessageStore::StreamName.get_id stream_name
7
- entity = MessageStore::StreamName.get_entity_name stream_name
8
- type_list = MessageStore::StreamName.get_types stream_name
5
+ def self.get(stream_name, consumer_identifier: nil)
6
+ stream_id = MessageStore::StreamName.get_id(stream_name)
7
+ entity = MessageStore::StreamName.get_entity_name(stream_name)
8
+ type_list = MessageStore::StreamName.get_types(stream_name)
9
9
 
10
10
  position_type = Type.get
11
11
 
12
- type_list << position_type unless type_list.include? position_type
12
+ type_list << position_type unless type_list.include?(position_type)
13
+
14
+ unless consumer_identifier.nil?
15
+ if stream_id.nil?
16
+ stream_id = consumer_identifier
17
+ else
18
+ stream_id = "#{stream_id}-#{consumer_identifier}"
19
+ end
20
+ end
13
21
 
14
22
  MessageStore::StreamName.stream_name(
15
23
  entity,
16
- id,
24
+ stream_id,
17
25
  types: type_list
18
26
  )
19
27
  end
@@ -9,11 +9,11 @@ module Consumer
9
9
  dependency :session, MessageStore::Postgres::Session
10
10
  dependency :write, ::Messaging::Postgres::Write
11
11
 
12
- def self.build(stream_name, session: nil)
13
- position_stream_name = StreamName.get stream_name
12
+ def self.build(stream_name, session: nil, consumer_identifier: nil)
13
+ position_stream_name = StreamName.get(stream_name, consumer_identifier: consumer_identifier)
14
14
 
15
15
  instance = new position_stream_name
16
- MessageStore::Postgres::Session.configure instance, session: session
16
+ MessageStore::Postgres::Session.configure(instance, session: session)
17
17
  instance.configure
18
18
  instance
19
19
  end
@@ -25,7 +25,7 @@ module Consumer
25
25
  attr_name: :read
26
26
  )
27
27
 
28
- Messaging::Postgres::Write.configure self, session: session
28
+ Messaging::Postgres::Write.configure(self, session: session)
29
29
  end
30
30
 
31
31
  def get
@@ -17,6 +17,7 @@ module Consumer
17
17
  self,
18
18
  stream_name,
19
19
  position_store: position_store,
20
+ consumer_identifier: identifier,
20
21
  session: session
21
22
  )
22
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-consumer-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.3
4
+ version: 0.2.1.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-06-01 00:00:00.000000000 Z
11
+ date: 2017-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-consumer
@@ -63,6 +63,7 @@ files:
63
63
  - lib/consumer/postgres/controls/category.rb
64
64
  - lib/consumer/postgres/controls/consumer.rb
65
65
  - lib/consumer/postgres/controls/id.rb
66
+ - lib/consumer/postgres/controls/identifier.rb
66
67
  - lib/consumer/postgres/controls/message_data.rb
67
68
  - lib/consumer/postgres/controls/position.rb
68
69
  - lib/consumer/postgres/controls/position/store/updated.rb