public static interface KafkaPublisher.Preparer
send()
is called.Modifier and Type | Method and Description |
---|---|
KafkaPublisher.Preparer |
add(ByteBuffer message,
Object partitionKey)
Adds the given message to the message set, partitioned with the given partition key.
|
com.google.common.util.concurrent.ListenableFuture<Integer> |
send()
Sends all the messages being added through the
add(java.nio.ByteBuffer, java.lang.Object) method. |
KafkaPublisher.Preparer add(ByteBuffer message, Object partitionKey)
message
- Remaining bytes in the ByteBuffer will be used as message payload. This method would
consume the ByteBuffer, meaning after this method returns, the remaining bytes in the
ByteBuffer would be 0
.partitionKey
- Key for computing the partition Id to publish to. The Object.hashCode()
method
will be invoke to compute the id.KafkaPublisher.Preparer
instance.com.google.common.util.concurrent.ListenableFuture<Integer> send()
add(java.nio.ByteBuffer, java.lang.Object)
method.ListenableFuture
that will be completed when the send action is done. If publish is succeeded,
it returns number of messages published, otherwise the failure reason will be carried in the future.
The Future.cancel(boolean)
method has no effect on the publish action.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.