Module: Messaging::Controls::Metadata::Random

Defined in:
lib/messaging/controls/metadata.rb

Class Method Summary collapse

Class Method Details

.causation_message_global_positionObject



142
143
144
# File 'lib/messaging/controls/metadata.rb', line 142

def self.causation_message_global_position
  Controls::Random::Number.example
end

.causation_message_identifierObject



162
163
164
# File 'lib/messaging/controls/metadata.rb', line 162

def self.causation_message_identifier
  "#{causation_message_stream_name}/#{causation_message_position}"
end

.causation_message_positionObject



138
139
140
# File 'lib/messaging/controls/metadata.rb', line 138

def self.causation_message_position
  Controls::Random::Number.example
end

.causation_message_stream_nameObject



134
135
136
# File 'lib/messaging/controls/metadata.rb', line 134

def self.causation_message_stream_name
  Controls::Random::Text.example
end

.correlation_stream_nameObject



146
147
148
# File 'lib/messaging/controls/metadata.rb', line 146

def self.correlation_stream_name
  Controls::Random::Text.example
end

.dataObject



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/messaging/controls/metadata.rb', line 182

def self.data
  {
    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::Random.example,
    local_properties: LocalProperties::Random.example,

    time: time,

    schema_version: schema_version
  }
end

.exampleObject



117
118
119
120
121
122
123
124
# File 'lib/messaging/controls/metadata.rb', line 117

def self.example
  data = self.data

  data[:properties] = properties
  data[:local_properties] = local_properties

  Messaging::Message::Metadata.build(data)
end

.global_positionObject



166
167
168
# File 'lib/messaging/controls/metadata.rb', line 166

def self.global_position
  Controls::Random::Number.example
end

.identifierObject



158
159
160
# File 'lib/messaging/controls/metadata.rb', line 158

def self.identifier
  "#{stream_name}/#{position}"
end

.local_propertiesObject



178
179
180
# File 'lib/messaging/controls/metadata.rb', line 178

def self.local_properties
  LocalProperties::Random.example
end

.positionObject



130
131
132
# File 'lib/messaging/controls/metadata.rb', line 130

def self.position
  Controls::Random::Number.example
end

.propertiesObject



174
175
176
# File 'lib/messaging/controls/metadata.rb', line 174

def self.properties
  Properties::Random.example
end

.reply_stream_nameObject



150
151
152
# File 'lib/messaging/controls/metadata.rb', line 150

def self.reply_stream_name
  Controls::Random::Text.example
end

.schema_versionObject



154
155
156
# File 'lib/messaging/controls/metadata.rb', line 154

def self.schema_version
  Controls::Random::Number.example.to_s
end

.stream_nameObject



126
127
128
# File 'lib/messaging/controls/metadata.rb', line 126

def self.stream_name
  Controls::Random::Text.example
end

.timeObject



170
171
172
# File 'lib/messaging/controls/metadata.rb', line 170

def self.time
  (::Time.now + Controls::Random::Number.example).utc
end