Class: Bricolage::StreamingLoad::S3ObjectDispatcherMessage
- Inherits:
-
DispatcherMessage
- Object
- Bricolage::SQSMessage
- DispatcherMessage
- Bricolage::StreamingLoad::S3ObjectDispatcherMessage
- Defined in:
- lib/bricolage/streamingload/dispatchermessage.rb
Constant Summary
Constants inherited from Bricolage::SQSMessage
Bricolage::SQSMessage::SQS_EVENT_SOURCE
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Bricolage::SQSMessage
#delay_seconds, #message_id, #name, #receipt_handle, #source, #time
Class Method Summary collapse
Instance Method Summary collapse
- #chunk ⇒ Object
- #created_event? ⇒ Boolean
-
#data? ⇒ Boolean
override.
- #init_message(region:, bucket:, key:, size:) ⇒ Object
- #message_type ⇒ Object
- #url ⇒ Object
Methods inherited from DispatcherMessage
Methods inherited from Bricolage::SQSMessage
#body, create, for_sqs_record, for_sqs_result, get_event_time, #initialize
Constructor Details
This class inherits a constructor from Bricolage::SQSMessage
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
135 136 137 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 135 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
136 137 138 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 136 def key @key end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
134 135 136 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 134 def region @region end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
137 138 139 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 137 def size @size end |
Class Method Details
.parse_sqs_record(msg, rec) ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 114 def S3ObjectDispatcherMessage.parse_sqs_record(msg, rec) { region: rec['awsRegion'], bucket: rec['s3']['bucket']['name'], key: rec['s3']['object']['key'], size: rec['s3']['object']['size'] } end |
Instance Method Details
#chunk ⇒ Object
152 153 154 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 152 def chunk Chunk.new(id: nil, url: url, size: size) end |
#created_event? ⇒ Boolean
148 149 150 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 148 def created_event? !!(/\AObjectCreated:(?!Copy)/ =~ @name) end |
#data? ⇒ Boolean
override
144 145 146 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 144 def data? true end |
#init_message(region:, bucket:, key:, size:) ⇒ Object
127 128 129 130 131 132 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 127 def (region:, bucket:, key:, size:) @region = region @bucket = bucket @key = key @size = size end |
#message_type ⇒ Object
123 124 125 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 123 def 'data' end |
#url ⇒ Object
139 140 141 |
# File 'lib/bricolage/streamingload/dispatchermessage.rb', line 139 def url "s3://#{@bucket}/#{@key}" end |