var EventEmitter = require('events').EventEmitter;
var util = require('util');
var AWS = require('aws-sdk');
var requiredOptions = [
    'queueUrl',
    'region',
    'handleMessage'
  ];

function validateOptions(options) {
  requiredOptions.forEach(function (option) {
    if (!options[option]) {
     throw new Error('Missing SQS consumer option [' + option + '].');
    }
  });
}

/**
 * An SQS consumer.
 * @param {object} options
 * @param {string} options.queueUrl
 * @param {string} options.region
 * @param {function} options.handleMessage
 * @param {number} options.waitTime
 * @param {object} options.sqs
 */
function Consumer(options) {
  validateOptions(options);
  AWS.config.update({region: options.region});

  this.queueUrl = options.queueUrl;
  this.handleMessage = options.handleMessage;
  this.waitTime = options.waitTime || 100;
  this.sqs = options.sqs || new AWS.SQS();
}

util.inherits(Consumer, EventEmitter);

/**
 * Start polling for messages.
 */
Consumer.prototype.start = function () {
  var options = {
    QueueUrl: this.queueUrl,
    MaxNumberOfMessages: 1,
    WaitTimeSeconds: 20
  };

  this.sqs.receiveMessage(options, this._handleSqsResponse.bind(this));
};


Consumer.prototype._handleSqsResponse = function(err, response) {
  if (err) this.emit('error', err);

  if (response && response.Messages && response.Messages.length > 0) {
    var message = response.Messages[0];

    this.emit('message_received', message);
    this._handleSqsMessage(message);
  }

  // Start polling for a new message after the wait time.
  setTimeout(this.start.bind(this), this.waitTime);
};

Consumer.prototype._handleSqsMessage = function (message) {
  var consumer = this;

  this.handleMessage(message, function (err) {
    if (err) return consumer.emit('error', err);

    consumer._deleteMessage(message);
  });
};

Consumer.prototype._deleteMessage = function (message) {
  var consumer = this;
  var options = {
    QueueUrl: this.queueUrl,
    ReceiptHandle: message.ReceiptHandle
  };

  this.sqs.deleteMessage(options, function (err) {
    if (err) return consumer.emit('error', err);

    consumer.emit('message_processed', message);
  });
};

module.exports = Consumer;
@@ -1011,30 +1011,36 @@
  () %7B%0A  var 
-option
+receiveParam
 s = %7B%0A    Qu
@@ -1146,22 +1146,28 @@
 Message(
-option
+receiveParam
 s, this.
@@ -1933,22 +1933,27 @@
 ;%0A  var 
-option
+deleteParam
 s = %7B%0A  
@@ -2051,22 +2051,27 @@
 Message(
-option
+deleteParam
 s, funct

Rename options variables