Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEclipse
titleRecordCallback
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);
}

Alternatives

There is a possibility where getMetadataAsync could call the given RecordCallback once even though we might be splitting the work into multiple threads. When implementing this change, the most likely approach will be having a primary thread acting as a parent for the other threads (i.e. it decides when threads are terminated and executed). The child threads will not have the original callback, but instead a modified one. These modified callbacks are used to notify the parent thread when they are done processing their respective tasks and once all threads are done processing, then we call the callback to maintain behavior. It really comes down to how it works out in the code, but it is worth consideration.


Compatibility, Deprecation, and Migration Plan

...

For example, the original metadataForStore method will call processMetadataForStore(boolean inOrder) with inOrder having a value of falsetrue. If the configs indicated that we are processing using multiple threads, then an exception will be thrown. 

...