title: How to process SQS queue with lambda function (not via scheduled events)?
body: <p>Here is the simplified scheme I am trying to make work:</p>
  
  <blockquote>
    <p>http requests --> (Gateway API + lambda A) --> SQS --> (lambda B
    ?????) --> DynamoDB</p>
  </blockquote>
  
  <p>So it should work as shown: data coming from many http requests (up to 500 per second, for example)
  is placed into SQS queue by my lambda function A. Then the other function, B, processes the queue: 
  reads up to 10 items (on some periodical basis) and writes them to DynamoDB with BatchWriteItem.</p>
  
  <p>The problem is that I can't figure out how to trigger the second lambda function. It should be called frequently, multiple times per second (or at least once per second), because I need all the data from the queue to get into DynamoDB ASAP (that's why calling lambda function B via scheduled events as described <a href="http://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html" rel="noreferrer" title="Using AWS Lambda with Scheduled Events">here</a> is not a option)</p>
  
  <hr>
  
  <p><strong>Why don't I want to write directly into DynamoDB, without SQS?</strong></p>
  
  <p><strike>That would be great for me to avoid using SQS at all. The problem that I am trying to address with SQS is DynamoDB throttling. Not even throttling itself but the way it is handled while writing data to DynamoDB with AWS SDK: when writing records one by one and getting them throttled, AWS SDK silently retries writing, resulting in increasing of the request processing time from the http client's point of view.</p>
  
  <p>So I would like to temporarily store data in the queue, send response "200 OK" back to client, and then get queue processed by separate function,
  writing multiple records with one DynamoDB's BatchWriteItem call (which
  returns Unprocessed items instead of automatic retry in case of throttling). <strong>I would even prefer to lose some records</strong> instead of increasing the lag between a record being received and stored in DynamoDB
  </strike></p>
  
  <p><strong>UPD:</strong> If anyone is interested, I have found how to make aws-sdk skip automatic retries in case of throttling: there is a special parameter <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#maxRetries-property" rel="noreferrer">maxRetries</a>. Anyway, going to use Kinesis as suggested below</p>