lib/activity/poller.js
function ActivityPoller(name, domain, options) {
  if (!(this instanceof ActivityPoller)) {
    return new ActivityPoller(name, domain, options);
  }

  events.EventEmitter.call(this);

  if (!_.isString(name)) {
    throw new Error('A `name` is required');
  }

  if (!_.isString(domain)) {
    throw new Error('A `domain` is required');
  }

  this.name = name;
  this.domain = domain;
  this.options = options || {};

  // Make sure taskList is an object of { name: '' }
  if (this.options.taskList && _.isString(this.options.taskList)) {
    this.options.taskList = { name: this.options.taskList };
  }

  // Set default taskList if not defined
  if (!this.options.taskList) {
    this.options.taskList = { name: this.name + '-tasklist' };
  }

  /** @private */
  this._registrations = [];
  this._activities = {};
  this._poller = undefined;

}
function ActivityPoller(name, domain, options) {
  if (!(this instanceof ActivityPoller)) {
    return new ActivityPoller(name, domain, options);
  }

  events.EventEmitter.call(this);

  if (!_.isString(name)) {
    throw new Error('A `name` is required');
  }

  if (!_.isString(domain)) {
    throw new Error('A `domain` is required');
  }

  this.name = name;
  this.domain = domain;
  this.options = options || {};

  // Make sure taskList is an object of { name: '' }
  if (this.options.taskList && _.isString(this.options.taskList)) {
    this.options.taskList = { name: this.options.taskList };
  }

  // Set default taskList if not defined
  if (!this.options.taskList) {
    this.options.taskList = { name: this.name + '-tasklist' };
  }

  /** @private */
  this._registrations = [];
  this._activities = {};
  this._poller = undefined;

}
function ActivityPoller ( name , domain , options ) { if ( ! ( this instanceof ActivityPoller ) ) { return new ActivityPoller ( name , domain , options ) ; } events . EventEmitter . call ( this ) ; if ( ! _ . isString ( name ) ) { throw new Error ( 'A `name` is required' ) ; } if ( ! _ . isString ( domain ) ) { throw new Error ( 'A `domain` is required' ) ; } this . name = name ; this . domain = domain ; this . options = options || { } ; // Make sure taskList is an object of { name: '' } if ( this . options . taskList && _ . isString ( this . options . taskList ) ) { this . options . taskList = { name : this . options . taskList } ; } // Set default taskList if not defined if ( ! this . options . taskList ) { this . options . taskList = { name : this . name + '-tasklist' } ; } /** @private */ this . _registrations = [ ] ; this . _activities = { } ; this . _poller = undefined ; }
Represents a single, named poller, where all activities are defined.
@constructor
@param {string} name - The name of the poller. This is arbitrary and has no bering on SWF.
@param {string} domain - The AWS SWF domain name to execute this pollers activities in.
@param {object} [options] - Additional options used when polling for new activities
(taskList)
Represents a single named poller where all activities are defined .