Last data update: 2014.03.03

R: Creating KAFKA producer
rkafka.createProducerR Documentation

Creating KAFKA producer

Description

This function is used to create a KAFKA producer

Usage

rkafka.createProducer(metadataBrokerList, producerType="sync", 
compressionCodec="none", serializerClass="kafka.serializer.StringEncoder", 
partitionerClass="NULL", compressedTopics="NULL", 
queueBufferingMaxTime="NULL", queueBufferingMaxMessages="NULL", 
queueEnqueueTimeoutTime="NULL", batchNumMessages="NULL")

Arguments

metadataBrokerList

List of brokers used for bootstrapping knowledge about the rest of the cluster format: host1:port1,host2:port2... Required:Mandatory Type:String default:localhost:9092

producerType

specifies whether the messages are sent asynchronously (async) or synchronously (sync) Required:Mandatory Type:String default:sync

compressionCodec

specify the compression codec for all data generated: none , gzip, snappy. Required:Mandatory Type:String default:none

serializerClass

specifies the class for serialization Required:Mandatory Type:String default:kafka.serializer.StringEncoder

partitionerClass

name of the partitioner class for partitioning events Required:Optional Type:String default:NULL(default partition spreads data randomly)

compressedTopics

allow topic level compression Required:Optional Type:String default:NULL

queueBufferingMaxTime

maximum time, in milliseconds, for buffering data on the producer queue Required:Optional(for Async Producer only) Type:String default:NULL

queueBufferingMaxMessages

the maximum size of the blocking queue for buffering on the producer Required:Optional(for Async Producer only) Type:String default:NULL

queueEnqueueTimeoutTime

0: events will be enqueued immediately or dropped if the queue is full -ve: enqueue will block indefinitely if the queue is full +ve: enqueue will block up to this many milliseconds if the queue is full Required:Optional(for Async Producer only) Type:String default:NULL

batchNumMessages

the number of messages batched at the producer Required:Optional(for Async Producer only) Type:String default:NULL

Value

Returns Producer

Author(s)

Shruti Gupta

Examples

## Not run: 
producer1=rkafka.createProducer("127.0.0.1:9092")
producer2=rkafka.createProducer("127.0.0.1:9092","sync","none","kafka.serializer.StringEncoder")

## End(Not run)
  

Results