lib/api.js
function(params, messages, cb) {
    var correlationId = _cbt.put(prodResponse(cb));
    var msg = envelope(prod.encode()
                           .correlation(correlationId)
                           .client(_options.clientId)
                           .timeout()
                           .topic(params.topic)
                           .partition(params.partition)
                           .messages(messages)
                           .end());
    sendMsg(msg, correlationId, cb);
  }
function(params, messages, cb) {
    var correlationId = _cbt.put(prodResponse(cb));
    var msg = envelope(prod.encode()
                           .correlation(correlationId)
                           .client(_options.clientId)
                           .timeout()
                           .topic(params.topic)
                           .partition(params.partition)
                           .messages(messages)
                           .end());
    sendMsg(msg, correlationId, cb);
  }
function ( params , messages , cb ) { var correlationId = _cbt . put ( prodResponse ( cb ) ) ; var msg = envelope ( prod . encode ( ) . correlation ( correlationId ) . client ( _options . clientId ) . timeout ( ) . topic ( params . topic ) . partition ( params . partition ) . messages ( messages ) . end ( ) ) ; sendMsg ( msg , correlationId , cb ) ; }
write a produce request to kafka

params:
topic: the topic to write to
partition: the partition to write to

messages: an array of messages to write to kafkia, messages may be
- a string
- an array of string
- an array of objects of the form {key: ..., value: ...}
if key value pairs exist the key will be written to kafka for reference purposes
otherwise a null key will be used
write a produce request to kafka