Skip to content

Commit

Permalink
Closes #514
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperlink committed Nov 16, 2016
1 parent e8522ed commit 0297825
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Kafka-node is a Node.js client with Zookeeper integration for Apache Kafka 0.8.1
- [FailedToRebalanceConsumerError: Exception: NODE_EXISTS[-110]](#failedtorebalanceconsumererror-exception-node_exists-110)
- [HighLevelConsumer does not consume on all partitions](#highlevelconsumer-does-not-consume-on-all-partitions)
- [How to throttle messages / control the concurrency of processing messages](#how-to-throttle-messages--control-the-concurrency-of-processing-messages)
- [How do I consume binary data?](#how-do-i-consume-binary-data)
- [How do I produce and consume binary data?](#how-do-i-produce-and-consume-binary-data)
- [Running Tests](#running-tests)
- [LICENSE - "MIT"](#license---mit)

Expand Down Expand Up @@ -892,11 +892,21 @@ Reference to issue [#339](https://github.com/SOHU-Co/kafka-node/issues/339)
2. Set the `queue.drain` to resume the consumer
3. The handler for consumer's `message` event pauses the consumer and pushes the message to the queue.

## How do I consume binary data?
## How do I produce and consume binary data?

In the consumer set the `encoding` option to `buffer` there not settings on producers needed for this.
### Consume
In the consumer set the `encoding` option to `buffer`.

Reference to issue [#470](https://github.com/SOHU-Co/kafka-node/issues/470)
### Produce
Set the `messages` attribute in the `payload` to a `Buffer`. `TypedArrays` such as `Uint8Array` are not supported and need to be converted to a `Buffer`.

```js
{
messages: Buffer.from(data.buffer)
}
```

Reference to issue [#470](https://github.com/SOHU-Co/kafka-node/issues/470) [#514](https://github.com/SOHU-Co/kafka-node/issues/514)

# Running Tests

Expand Down

0 comments on commit 0297825

Please sign in to comment.