This function is used to create a KAFKA producer
rkafka.createProducer(metadataBrokerList, producerType="sync",
compressionCodec="none", serializerClass="kafka.serializer.StringEncoder",
partitionerClass="NULL", compressedTopics="NULL",
queueBufferingMaxTime="NULL", queueBufferingMaxMessages="NULL",
queueEnqueueTimeoutTime="NULL", batchNumMessages="NULL")
Returns Producer
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
specifies whether the messages are sent asynchronously (async) or synchronously (sync) Required:Mandatory Type:String default:sync
specify the compression codec for all data generated: none , gzip, snappy. Required:Mandatory Type:String default:none
specifies the class for serialization Required:Mandatory Type:String default:kafka.serializer.StringEncoder
name of the partitioner class for partitioning events Required:Optional Type:String default:NULL(default partition spreads data randomly)
allow topic level compression Required:Optional Type:String default:NULL
maximum time, in milliseconds, for buffering data on the producer queue Required:Optional(for Async Producer only) Type:String default:NULL
the maximum size of the blocking queue for buffering on the producer Required:Optional(for Async Producer only) Type:String default:NULL
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
the number of messages batched at the producer Required:Optional(for Async Producer only) Type:String default:NULL
Shruti Gupta
if (FALSE) {
producer1=rkafka.createProducer("127.0.0.1:9092")
producer2=rkafka.createProducer("127.0.0.1:9092","sync","none","kafka.serializer.StringEncoder")
}
Run the code above in your browser using DataLab