Class: ElasticGraph::IndexerLambda::LambdaFunction

Inherits:
Object
  • Object
show all
Includes:
LambdaSupport::LambdaFunction
Defined in:
lib/elastic_graph/indexer_lambda/lambda_function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLambdaFunction

Returns a new instance of LambdaFunction.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elastic_graph/indexer_lambda/lambda_function.rb', line 21

def initialize
  require "elastic_graph/indexer_lambda"
  require "elastic_graph/indexer_lambda/sqs_processor"

  indexer = ElasticGraph::IndexerLambda.indexer_from_env
  ignore_sqs_latency_timestamps_from_arns = ::JSON.parse(ENV.fetch("IGNORE_SQS_LATENCY_TIMESTAMPS_FROM_ARNS", "[]")).to_set

  @sqs_processor = ElasticGraph::IndexerLambda::SqsProcessor.new(
    indexer.processor,
    ignore_sqs_latency_timestamps_from_arns: ignore_sqs_latency_timestamps_from_arns,
    logger: indexer.logger
  )
end

Instance Attribute Details

#sqs_processorObject (readonly)

Returns the value of attribute sqs_processor.



19
20
21
# File 'lib/elastic_graph/indexer_lambda/lambda_function.rb', line 19

def sqs_processor
  @sqs_processor
end

Instance Method Details

#handle_request(event:, context:) ⇒ Object



35
36
37
# File 'lib/elastic_graph/indexer_lambda/lambda_function.rb', line 35

def handle_request(event:, context:)
  @sqs_processor.process(event)
end