Class: Bricolage::StreamingLoad::StreamingLoadV3LoaderMessage

Inherits:
LoaderMessage show all
Defined in:
lib/bricolage/streamingload/loadermessage.rb

Constant Summary

Constants inherited from Bricolage::SQSMessage

Bricolage::SQSMessage::SQS_EVENT_SOURCE

Instance Attribute Summary collapse

Attributes inherited from Bricolage::SQSMessage

#delay_seconds, #message_id, #name, #receipt_handle, #source, #time

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LoaderMessage

#data?, get_concrete_class

Methods inherited from Bricolage::SQSMessage

for_sqs_record, for_sqs_result, get_event_time, #initialize

Constructor Details

This class inherits a constructor from Bricolage::SQSMessage

Instance Attribute Details

#task_idObject (readonly)

Returns the value of attribute task_id.



51
52
53
# File 'lib/bricolage/streamingload/loadermessage.rb', line 51

def task_id
  @task_id
end

Class Method Details

.create(task_id:, force: false) ⇒ Object



33
34
35
# File 'lib/bricolage/streamingload/loadermessage.rb', line 33

def StreamingLoadV3LoaderMessage.create(task_id:, force: false)
  super name: 'streaming_load_v3', task_id: task_id, force: force
end

.for_load_task(load_task) ⇒ Object



29
30
31
# File 'lib/bricolage/streamingload/loadermessage.rb', line 29

def StreamingLoadV3LoaderMessage.for_load_task(load_task)
  create(task_id: load_task.id)
end

.parse_sqs_record(msg, rec) ⇒ Object



37
38
39
40
41
42
# File 'lib/bricolage/streamingload/loadermessage.rb', line 37

def StreamingLoadV3LoaderMessage.parse_sqs_record(msg, rec)
  {
    task_id: rec['taskId'],
    force: (rec['force'].to_s == 'true')
  }
end

Instance Method Details

#bodyObject



57
58
59
60
61
62
# File 'lib/bricolage/streamingload/loadermessage.rb', line 57

def body
  obj = super
  obj['taskId'] = @task_id
  obj['force'] = true if @force
  obj
end

#force?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/bricolage/streamingload/loadermessage.rb', line 53

def force?
  !!@force
end

#init_message(task_id:, force: false) ⇒ Object



46
47
48
49
# File 'lib/bricolage/streamingload/loadermessage.rb', line 46

def init_message(task_id:, force: false)
  @task_id = task_id
  @force = force
end