lib/kafkaesque.js
function() {
    _cbt =  require('./cbt')();
    _options = options || {};

    // apply defaults
    // the min bytes of an incoming reply
    _options.minBytes = _options.minBytes || 1;

    // the max bytes of an incoming reply
    _options.maxBytes = _options.maxBytes || 1024 * 1024;

    // the group the client will join when using `.connect()`
    _options.group = _options.group || 'kafkaesqueGroup';

    // the clientID when connecting to kafka
    _options.clientId = _options.clientId || 'kafkaesque' + Math.floor(Math.random() * 100000000);

    // the array of brokers
    _options.brokers = _options.brokers || [{host: 'localhost', port: 9092}];

    // the amount of time it should take for this clients session within the group
    // to timeout
    _options.sessionTimeout = _options.sessionTimeout || 6000;

    // the amount of time to take to emit a heartbeat msg
    _options.heartbeat = _options.heartbeat || 2500;

    // the default amount of time that the kafka broker shoudl wait to send
    // a reply to a fetch request if the fetch reply is smaller than the minBytes
    _options.maxWait = _options.maxWait || 5000;

    _brokers = {};
    _topics = {};
    _groupMemberId = '';
    _groupGeneration = 0;
    _.each(_options.brokers, function(broker) {
      broker = {
        host: broker.host,
        port: broker.port,
        maxBytes: _options.maxBytes,
        minBytes: _options.minBytes,
        clientId: _options.clientId
      };

      _brokers[_makeBrokerKey(broker)] = api(broker);
    });

    _metaBroker = _brokers[_makeBrokerKey(_options.brokers[0])];
  }
function() {
    _cbt =  require('./cbt')();
    _options = options || {};

    // apply defaults
    // the min bytes of an incoming reply
    _options.minBytes = _options.minBytes || 1;

    // the max bytes of an incoming reply
    _options.maxBytes = _options.maxBytes || 1024 * 1024;

    // the group the client will join when using `.connect()`
    _options.group = _options.group || 'kafkaesqueGroup';

    // the clientID when connecting to kafka
    _options.clientId = _options.clientId || 'kafkaesque' + Math.floor(Math.random() * 100000000);

    // the array of brokers
    _options.brokers = _options.brokers || [{host: 'localhost', port: 9092}];

    // the amount of time it should take for this clients session within the group
    // to timeout
    _options.sessionTimeout = _options.sessionTimeout || 6000;

    // the amount of time to take to emit a heartbeat msg
    _options.heartbeat = _options.heartbeat || 2500;

    // the default amount of time that the kafka broker shoudl wait to send
    // a reply to a fetch request if the fetch reply is smaller than the minBytes
    _options.maxWait = _options.maxWait || 5000;

    _brokers = {};
    _topics = {};
    _groupMemberId = '';
    _groupGeneration = 0;
    _.each(_options.brokers, function(broker) {
      broker = {
        host: broker.host,
        port: broker.port,
        maxBytes: _options.maxBytes,
        minBytes: _options.minBytes,
        clientId: _options.clientId
      };

      _brokers[_makeBrokerKey(broker)] = api(broker);
    });

    _metaBroker = _brokers[_makeBrokerKey(_options.brokers[0])];
  }
function ( ) { _cbt = require ( './cbt' ) ( ) ; _options = options || { } ; // apply defaults // the min bytes of an incoming reply _options . minBytes = _options . minBytes || 1 ; // the max bytes of an incoming reply _options . maxBytes = _options . maxBytes || 1024 * 1024 ; // the group the client will join when using `.connect()` _options . group = _options . group || 'kafkaesqueGroup' ; // the clientID when connecting to kafka _options . clientId = _options . clientId || 'kafkaesque' + Math . floor ( Math . random ( ) * 100000000 ) ; // the array of brokers _options . brokers = _options . brokers || [ { host : 'localhost' , port : 9092 } ] ; // the amount of time it should take for this clients session within the group // to timeout _options . sessionTimeout = _options . sessionTimeout || 6000 ; // the amount of time to take to emit a heartbeat msg _options . heartbeat = _options . heartbeat || 2500 ; // the default amount of time that the kafka broker shoudl wait to send // a reply to a fetch request if the fetch reply is smaller than the minBytes _options . maxWait = _options . maxWait || 5000 ; _brokers = { } ; _topics = { } ; _groupMemberId = '' ; _groupGeneration = 0 ; _ . each ( _options . brokers , function ( broker ) { broker = { host : broker . host , port : broker . port , maxBytes : _options . maxBytes , minBytes : _options . minBytes , clientId : _options . clientId } ; _brokers [ _makeBrokerKey ( broker ) ] = api ( broker ) ; } ) ; _metaBroker = _brokers [ _makeBrokerKey ( _options . brokers [ 0 ] ) ] ; }
construct the kafka clients
construct the kafka clients