mjsax commented on code in PR #18314: URL: https://github.com/apache/kafka/pull/18314#discussion_r1896961093
########## docs/streams/developer-guide/dsl-api.html: ########## @@ -3243,6 +3244,177 @@ <h5><a class="toc-backref" href="#id34">KTable-KTable Foreign-Key // `Processor` interface, see further down below. .process(() -> new PopularPageEmailAlert("ale...@yourcompany.com"));</code></pre> </div> + <div class="section" id="migrating-from-transform-to-process"> + <h2> + <a class="headerlink" href="#migrating-from-transform-to-process" title="Permalink to this headline"> + Migrating from transform to process + </a> + </h2> + <div> + <p> + As of Kafka 4.0, several deprecated methods in the Kafka Streams API, such as <code>transform</code>, + <code>flatTransform</code>, <code>transformValues</code>, and <code>flatTransformValues</code>, have + been removed. These methods have been replaced with the more versatile <code>process</code> API. This + guide provides detailed steps for migrating existing code to use the new <code>process</code> API and + explains the benefits of the changes. + </p> + <h3>Overview of Changes</h3> + <p>The following deprecated methods are no longer available in Kafka Streams:</p> + <ul> + <li><code>KStream#transform</code></li> + <li><code>KStream#flatTransform</code></li> + <li><code>KStream#transformValues</code></li> + <li><code>KStream#flatTransformValues</code></li> + </ul> + <p>The <code>process</code> API now serves as a unified replacement for all these methods. It simplifies the + API surface while maintaining support for both stateless and stateful operations.</p> + + <h3>Migration Steps</h3> + + <h4>1. Migrate from <code>transform</code> to <code>process</code></h4> + + <pre class="line-numbers"><code class="language-java">// Before +KStream<String, String> transformedStream = stream.transform( + () -> new CustomTransformer(), + "state-store" +); + +// After +KStream<String, String> processedStream = stream.process( + () -> new CustomProcessor(), + "state-store" +);</code></pre> + + <h4>2. Migrate from <code>flatTransform</code> to <code>process</code></h4> + <pre class="line-numbers"><code class="language-java">// Before +KStream<String, String> flatTransformedStream = stream.flatTransform( + () -> new CustomFlatTransformer(), + "state-store" +); + +// After +KStream<String, String> processedStream = stream.process( + () -> new Processor<String, String>() { Review Comment: The new `api.Processor` has 4 generic, key/value in/out. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org