Configurations custom to this wrapper
| Field | Description | Type | Default |
|---|---|---|---|
| throttle | Throttle interval time (ms) | Number | 500 |
| topics | Topics to subscribe to | String[] | ['kafka-test-topic'] |
| autoInterval | Allow auto intervals for polling (producer) and consuming (consumer). | boolean | true |
Configurations custom to this wrapper's Consumer class.
| Field | Description | Type | Default |
|---|---|---|---|
| consumeMax | Number of messages to consume for each interval. | Number | 1 |
Kafka Consumer
Kind: global class
- Consumer
- new Consumer(conf, topicConfig)
- .connect() ⇒
Promise.<void> - .disconnect() ⇒
Promise.<void> - .message() ⇒
Observable.<T> - .consume(limit)
- .commit()
| Param | Type | Description |
|---|---|---|
| conf | ConsumerConfig |
defaults to default config |
| topicConfig | TopicConfig |
the Kafka Topic Configuration |
Connect to Kafka
Kind: instance method of Consumer
Disconnect from Kafka
Kind: instance method of Consumer
Message stream to listen to
Kind: instance method of Consumer
Returns: Observable.<T> - - message stream
Consume message
Kind: instance method of Consumer
| Param | Type | Description |
|---|---|---|
| limit | number |
limit or number of messages to consume |
Manual Commit
Kind: instance method of Consumer
Optional: @param {string=} topicPartition - topic partition to commit
Kafka Producer
Kind: global class
- Producer
- new Producer(conf, topicConfig)
- .connect() ⇒
Promise.<void> - .disconnect() ⇒
Promise.<void> - .publish(message, topic, partition, key, opaque) ⇒
Promise.<DeliveryReport> - .poll()
- .report() ⇒
Observable.<DeliveryReport>
| Param | Type | Description |
|---|---|---|
| conf | ProducerConfig |
defaults to default config |
| topicConfig | Config |
the Kafka Topic Configuration |
Connect to Kafka
Kind: instance method of Producer
Disconnect from Kafka
Kind: instance method of Producer
Publish a message
Kind: instance method of Producer
| Param | Type | Default | Description |
|---|---|---|---|
| message | String |
message to send | |
| topic | String |
topic to send to | |
| partition | number |
optionally specify a partition for the message, this defaults to -1 - which will use librdkafka's default partitioner (consistent random for keyed messages, random for unkeyed messages) | |
| key | String |
|
keyed message (optional) |
| opaque | String |
|
opaque token which gets passed along to your delivery reports |
Polls the producer for delivery reports or other events to be transmitted via the emitter.
Kind: instance method of Producer
Stream delivery report from the kafka producer
Kind: instance method of Producer