...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/** Retrieves record metadata for a topic asynchronously. This method does not block. * @param callback will be called when the records has been retrieved or has failed. * @param storeName the name of the store the user is querying. * / void getMetadataAsync(RecordCallback callback, String storeName); /** Retrieves offsets. If num.threads.per.task >= 1, then it will return offsets out of order. * @param inOrder the expectation for the offsets to be in order. * @param storeName name of store being queried. * @throws IllegalStateException if inorder == true when num.threads.per.task > 1 */ Collections<StreamsMetadata> processMetadataForStore(boolean inOrder, String storeName); |
|
The purpose of RecordCallback
is analogous to KafkaConsumer's OffsetCommitCallback
. The user would use this interface (or class?) to define the end behavior of a method. It could be used to notify the user that they could move on to processing the next record, or it could be used as a feedback loop to send another request for the same record (if it failed).
draw.io Diagram | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
If num.threads.per.task
is equal to one, then we go to our default policy. Otherwise, we would go with the second one. Please note that if getMetadataAsnyc
was supported for the case where num.threads.per.task
is greater than one, than there will be multiple calls to the user-provided callback because the request would be split into multiple asynchronous threads (who does not have any communications with one another). The callback could be seen below:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public interface RecordCallback {
/** A method which can be used by the client to define the behavior of the code after the metadata has been retrieved.
* @param exc An exception if one had occurred
* @param metadata The metadata retrieved (that is if successfully)
*/
public void onComplete(KafkaException exc, Collection<StreamsMetadata> metadata);
} |
Compatibility, Deprecation, and Migration Plan
...