Module: AggregateStreams::Controls::MessageData::Metadata

Defined in:
lib/aggregate_streams/controls/message_data/metadata.rb

Defined Under Namespace

Modules: Input, Output

Class Method Summary collapse

Class Method Details

.causation_message_global_positionObject



115
116
117
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 115

def self.causation_message_global_position
  Messaging::Controls::Metadata.causation_message_global_position
end

.causation_message_positionObject



111
112
113
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 111

def self.causation_message_position
  Messaging::Controls::Metadata.causation_message_position
end

.causation_message_stream_nameObject



107
108
109
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 107

def self.causation_message_stream_name
  Messaging::Controls::Metadata.causation_message_stream_name
end

.correlation_stream_nameObject



119
120
121
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 119

def self.correlation_stream_name
  Messaging::Controls::Metadata.correlation_stream_name
end

.example(category: nil, stream_id: nil, stream_name: nil, position: nil, global_position: nil, causation_message_stream_name: nil, causation_message_position: nil, causation_message_global_position: nil, correlation_stream_name: nil, reply_stream_name: nil, properties: nil, local_properties: nil, schema_version: nil) ⇒ Object



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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 5

def self.example(category: nil, stream_id: nil, stream_name: nil, position: nil, global_position: nil, causation_message_stream_name: nil, causation_message_position: nil, causation_message_global_position: nil, correlation_stream_name: nil, reply_stream_name: nil, properties: nil, local_properties: nil, schema_version: nil)
  if stream_name == :none
    stream_name = nil
  else
    stream_name ||= stream_name(id: stream_id, category: category)
  end

  if position == :none
    position = nil
  else
    position ||= self.position
  end

  if global_position == :none
    global_position = nil
  else
    global_position ||= self.global_position
  end

  if causation_message_stream_name == :none
    causation_message_stream_name = nil
  else
    causation_message_stream_name ||= self.causation_message_stream_name
  end

  if causation_message_position == :none
    causation_message_position = nil
  else
    causation_message_position ||= self.causation_message_position
  end

  if causation_message_global_position == :none
    causation_message_global_position = nil
  else
    causation_message_global_position ||= self.causation_message_global_position
  end

  if correlation_stream_name == :none
    correlation_stream_name = nil
  else
    correlation_stream_name ||= Metadata.correlation_stream_name
  end

  if reply_stream_name == :none
    reply_stream_name = nil
  else
    reply_stream_name ||= Metadata.reply_stream_name
  end

  if properties == :none
    properties = nil
  else
    properties ||= self.properties
  end

  if local_properties == :none
    local_properties = nil
  else
    local_properties ||= self.local_properties
  end

  if schema_version == :none
    schema_version = nil
  else
    schema_version ||= Metadata.schema_version
  end

   = {
    :stream_name => stream_name,
    :position => position,
    :global_position => global_position,

    :causation_message_stream_name => causation_message_stream_name,
    :causation_message_position => causation_message_position,
    :causation_message_global_position => causation_message_global_position,

    :correlation_stream_name => correlation_stream_name,
    :reply_stream_name => reply_stream_name,

    :properties => properties,
    :local_properties => local_properties,

    :schema_version => schema_version
  }

  .delete_if { |_, v| v.nil? }

  
end

.global_positionObject



103
104
105
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 103

def self.global_position
  Position::Global.example
end

.local_propertiesObject



131
132
133
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 131

def self.local_properties
  Messaging::Controls::LocalProperties.example
end

.positionObject



99
100
101
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 99

def self.position
  Position.example
end

.propertiesObject



127
128
129
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 127

def self.properties
  Messaging::Controls::Properties.example
end

.reply_stream_nameObject



123
124
125
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 123

def self.reply_stream_name
  Messaging::Controls::Metadata.reply_stream_name
end

.schema_versionObject



135
136
137
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 135

def self.schema_version
  Messaging::Controls::Metadata.schema_version
end

.stream_name(**args) ⇒ Object



95
96
97
# File 'lib/aggregate_streams/controls/message_data/metadata.rb', line 95

def self.stream_name(**args)
  StreamName.example(**args)
end