public static class ProducerRecords.ProducerRecord.Builder
extends java.lang.Object
ProducerRecords.ProducerRecord.Builder is a helper class implementing the builder pattern to easily create ProducerRecords.ProducerRecord
objects.| Constructor and Description |
|---|
Builder(java.lang.String topic,
java.lang.String payload)
ProducerRecords.ProducerRecord.Builder constructor asks for the ProducerRecords.ProducerRecord mandatory attributes which are topic and
payload. |
| Modifier and Type | Method and Description |
|---|---|
ProducerRecords.ProducerRecord |
build()
Create a brand new
ProducerRecords.ProducerRecord object which attributes are set to the values given for
topic, base64EncodedPayload, shardingKey and
headers |
ProducerRecords.ProducerRecord.Builder |
withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Set the headers value to be set in the upcoming
ProducerRecords.ProducerRecord object. |
ProducerRecords.ProducerRecord.Builder |
withShardingKey(java.lang.String shardingKey)
Set the shardingKey attribute value to be set in the upcoming
ProducerRecords.ProducerRecord object. |
public Builder(java.lang.String topic,
java.lang.String payload)
ProducerRecords.ProducerRecord.Builder constructor asks for the ProducerRecords.ProducerRecord mandatory attributes which are topic and
payload.topic - topic value to be set in ProducerRecord.routingData.topic attributepayload - payload value to be set in ProducerRecord.message.payload attributepublic ProducerRecords.ProducerRecord.Builder withShardingKey(java.lang.String shardingKey)
ProducerRecords.ProducerRecord object.shardingKey - value to set in the ProducerRecords.ProducerRecord.RoutingData.shardingKey attribute of the
ProducerRecords.ProducerRecord to be built.ProducerRecords.ProducerRecord.Builder instancepublic ProducerRecords.ProducerRecord.Builder withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
ProducerRecords.ProducerRecord object.headers - value to be set in the ProducerRecords.ProducerRecord.Message.headers attribute of the ProducerRecords.ProducerRecord
to be builtProducerRecords.ProducerRecord.Builder instancepublic ProducerRecords.ProducerRecord build()
ProducerRecords.ProducerRecord object which attributes are set to the values given for
topic, base64EncodedPayload, shardingKey and
headersProducerRecords.ProducerRecord object