evt-consumer-postgres 0.1.0.0 → 0.2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/consumer/postgres/controls/category.rb +1 -1
- data/lib/consumer/postgres/controls/consumer.rb +3 -3
- data/lib/consumer/postgres/controls/{event_data.rb → message_data.rb} +1 -1
- data/lib/consumer/postgres/controls/position/store/{message.rb → updated.rb} +2 -2
- data/lib/consumer/postgres/controls/position/stream/write.rb +1 -1
- data/lib/consumer/postgres/controls/stream_name.rb +1 -1
- data/lib/consumer/postgres/controls.rb +3 -3
- data/lib/consumer/postgres/position_store/stream_name.rb +4 -4
- data/lib/consumer/postgres/position_store/updated.rb +11 -0
- data/lib/consumer/postgres/position_store.rb +8 -8
- data/lib/consumer/postgres/postgres.rb +1 -1
- data/lib/consumer/postgres.rb +2 -1
- metadata +5 -5
- data/lib/consumer/postgres/position_store/messages.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283cd0516b31c8cd2b72cb9204f492d78de3b20b
|
4
|
+
data.tar.gz: 5e39ea1e268266ed5c1cdd926a9741aedc7d37f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8885e56016a5fa62ef65481e244149c00a30b122990bdd5201134e48a9e31a0679da38f64a05c03b6b55d97aa5c8566a5fc36fb8fb490d0530a2fcc00ceee036
|
7
|
+
data.tar.gz: 766f57b799fb75dd59b1cc4e7d0efc38366489b5152f08b5d5166b8024eff277e5c1982b576608a7babacbcae6ee795c31b893be65993868b8efae62d38601d5
|
@@ -9,9 +9,9 @@ module Consumer
|
|
9
9
|
class Incrementing
|
10
10
|
include ::Consumer::Postgres
|
11
11
|
|
12
|
-
handler do |
|
13
|
-
logger.info { "Handled
|
14
|
-
logger.debug {
|
12
|
+
handler do |message_data|
|
13
|
+
logger.info { "Handled message (StreamName: #{message_data.stream_name}, GlobalPosition: #{message_data.global_position})" }
|
14
|
+
logger.debug { message_data.data.pretty_inspect }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -3,11 +3,11 @@ module Consumer
|
|
3
3
|
module Controls
|
4
4
|
module Position
|
5
5
|
module Store
|
6
|
-
module
|
6
|
+
module Updated
|
7
7
|
def self.example(position: nil)
|
8
8
|
position ||= Position.example
|
9
9
|
|
10
|
-
message = PositionStore::
|
10
|
+
message = PositionStore::Updated.new
|
11
11
|
message.position = position
|
12
12
|
message
|
13
13
|
end
|
@@ -7,7 +7,7 @@ module Consumer
|
|
7
7
|
def self.call(stream_name=nil, position: nil)
|
8
8
|
stream_name ||= StreamName::Position.example
|
9
9
|
|
10
|
-
message = Store::
|
10
|
+
message = Store::Updated.example position: position
|
11
11
|
|
12
12
|
Messaging::Postgres::Write.(message, stream_name)
|
13
13
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'consumer/controls'
|
2
2
|
|
3
|
-
require '
|
3
|
+
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/
|
7
|
+
require 'consumer/postgres/controls/message_data'
|
8
8
|
require 'consumer/postgres/controls/position'
|
9
|
-
require 'consumer/postgres/controls/position/store/
|
9
|
+
require 'consumer/postgres/controls/position/store/updated'
|
10
10
|
require 'consumer/postgres/controls/position/stream/write'
|
11
11
|
require 'consumer/postgres/controls/stream_name'
|
12
12
|
|
@@ -3,15 +3,15 @@ module Consumer
|
|
3
3
|
class PositionStore
|
4
4
|
module StreamName
|
5
5
|
def self.get(stream_name)
|
6
|
-
id =
|
7
|
-
entity =
|
8
|
-
type_list =
|
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
|
9
9
|
|
10
10
|
position_type = Type.get
|
11
11
|
|
12
12
|
type_list << position_type unless type_list.include? position_type
|
13
13
|
|
14
|
-
|
14
|
+
MessageStore::StreamName.stream_name(
|
15
15
|
entity,
|
16
16
|
id,
|
17
17
|
types: type_list
|
@@ -5,21 +5,21 @@ module Consumer
|
|
5
5
|
|
6
6
|
initializer :stream_name
|
7
7
|
|
8
|
-
dependency :read,
|
9
|
-
dependency :session,
|
8
|
+
dependency :read, MessageStore::Postgres::Get::Last
|
9
|
+
dependency :session, MessageStore::Postgres::Session
|
10
10
|
dependency :write, ::Messaging::Postgres::Write
|
11
11
|
|
12
12
|
def self.build(stream_name, session: nil)
|
13
13
|
position_stream_name = StreamName.get stream_name
|
14
14
|
|
15
15
|
instance = new position_stream_name
|
16
|
-
|
16
|
+
MessageStore::Postgres::Session.configure instance, session: session
|
17
17
|
instance.configure
|
18
18
|
instance
|
19
19
|
end
|
20
20
|
|
21
21
|
def configure
|
22
|
-
|
22
|
+
MessageStore::Postgres::Get::Last.configure(
|
23
23
|
self,
|
24
24
|
session: session,
|
25
25
|
attr_name: :read
|
@@ -29,17 +29,17 @@ module Consumer
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def get
|
32
|
-
|
32
|
+
message_data = read.(stream_name)
|
33
33
|
|
34
|
-
return nil if
|
34
|
+
return nil if message_data.nil?
|
35
35
|
|
36
|
-
message = Messaging::Message::Import.(
|
36
|
+
message = Messaging::Message::Import.(message_data, Updated)
|
37
37
|
|
38
38
|
message.position
|
39
39
|
end
|
40
40
|
|
41
41
|
def put(position)
|
42
|
-
message =
|
42
|
+
message = Updated.new
|
43
43
|
message.position = position
|
44
44
|
|
45
45
|
write.(message, stream_name)
|
data/lib/consumer/postgres.rb
CHANGED
@@ -3,6 +3,7 @@ require 'consumer'
|
|
3
3
|
require 'messaging/postgres'
|
4
4
|
|
5
5
|
require 'consumer/postgres/position_store'
|
6
|
-
require 'consumer/postgres/position_store/
|
6
|
+
require 'consumer/postgres/position_store/updated'
|
7
7
|
require 'consumer/postgres/position_store/stream_name'
|
8
|
+
|
8
9
|
require 'consumer/postgres/postgres'
|
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.
|
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-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-consumer
|
@@ -62,15 +62,15 @@ files:
|
|
62
62
|
- lib/consumer/postgres/controls.rb
|
63
63
|
- lib/consumer/postgres/controls/category.rb
|
64
64
|
- lib/consumer/postgres/controls/consumer.rb
|
65
|
-
- lib/consumer/postgres/controls/event_data.rb
|
66
65
|
- lib/consumer/postgres/controls/id.rb
|
66
|
+
- lib/consumer/postgres/controls/message_data.rb
|
67
67
|
- lib/consumer/postgres/controls/position.rb
|
68
|
-
- lib/consumer/postgres/controls/position/store/
|
68
|
+
- lib/consumer/postgres/controls/position/store/updated.rb
|
69
69
|
- lib/consumer/postgres/controls/position/stream/write.rb
|
70
70
|
- lib/consumer/postgres/controls/stream_name.rb
|
71
71
|
- lib/consumer/postgres/position_store.rb
|
72
|
-
- lib/consumer/postgres/position_store/messages.rb
|
73
72
|
- lib/consumer/postgres/position_store/stream_name.rb
|
73
|
+
- lib/consumer/postgres/position_store/updated.rb
|
74
74
|
- lib/consumer/postgres/postgres.rb
|
75
75
|
homepage: https://github.com/eventide-project/consumer-postgres
|
76
76
|
licenses:
|