Class: ElasticGraph::IndexerLambda::SqsProcessor
- Inherits:
-
Object
- Object
- ElasticGraph::IndexerLambda::SqsProcessor
- Defined in:
- lib/elastic_graph/indexer_lambda/sqs_processor.rb
Overview
Responsible for handling lambda event payloads from an SQS lambda trigger.
Instance Attribute Summary collapse
-
#ignore_sqs_latency_timestamps_from_arns ⇒ Object
readonly
Returns the value of attribute ignore_sqs_latency_timestamps_from_arns.
Instance Method Summary collapse
-
#initialize(indexer_processor, logger:, ignore_sqs_latency_timestamps_from_arns:, s3_client: nil) ⇒ SqsProcessor
constructor
A new instance of SqsProcessor.
-
#process(lambda_event, refresh_indices: false) ⇒ Object
Processes the ElasticGraph events in the given ‘lambda_event`, indexing the data in the datastore.
Constructor Details
#initialize(indexer_processor, logger:, ignore_sqs_latency_timestamps_from_arns:, s3_client: nil) ⇒ SqsProcessor
Returns a new instance of SqsProcessor.
22 23 24 25 26 27 |
# File 'lib/elastic_graph/indexer_lambda/sqs_processor.rb', line 22 def initialize(indexer_processor, logger:, ignore_sqs_latency_timestamps_from_arns:, s3_client: nil) @indexer_processor = indexer_processor @logger = logger @s3_client = s3_client @ignore_sqs_latency_timestamps_from_arns = end |
Instance Attribute Details
#ignore_sqs_latency_timestamps_from_arns ⇒ Object (readonly)
Returns the value of attribute ignore_sqs_latency_timestamps_from_arns.
20 21 22 |
# File 'lib/elastic_graph/indexer_lambda/sqs_processor.rb', line 20 def @ignore_sqs_latency_timestamps_from_arns end |
Instance Method Details
#process(lambda_event, refresh_indices: false) ⇒ Object
Processes the ElasticGraph events in the given ‘lambda_event`, indexing the data in the datastore.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/elastic_graph/indexer_lambda/sqs_processor.rb', line 30 def process(lambda_event, refresh_indices: false) events = events_from(lambda_event) failures = @indexer_processor.process_returning_failures(events, refresh_indices: refresh_indices) if failures.any? failures_error = Indexer::IndexingFailuresError.for(failures: failures, events: events) @logger.error(failures_error.) end format_response(failures) end |