5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/consumer/event_store/position_store/stream_name.rb', line 5
def self.get(stream_name, consumer_identifier: nil)
match_data = MessageStore::EventStore::StreamName.parse(stream_name)
types = match_data[:type_list]
types = Array(types)
return stream_name if types.include?('position')
types << 'position'
entity_name = match_data[:entity]
stream_id = match_data[:stream_id]
unless consumer_identifier.nil?
if stream_id.nil?
stream_id = consumer_identifier
else
stream_id = "#{stream_id}-#{consumer_identifier}"
end
end
MessageStore::StreamName.stream_name(
entity_name,
stream_id,
types: types
)
end
|