eduwercamacaro commented on code in PR #20403:
URL: https://github.com/apache/kafka/pull/20403#discussion_r2494634809
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorTopologyTest.java:
##########
@@ -1264,6 +1281,31 @@ public void process(final Record<String, String> record)
{
}
}
+ private static class StatefulProcessorWithInitialization implements
Processor<String, String, Void, Void> {
+ private KeyValueStore<String, String> store;
+ private final String storeName;
+ private final String initialKey;
+ private final String initialValue;
+
+ public StatefulProcessorWithInitialization(final String storeName,
final String initialKey, final String initialValue) {
+ this.storeName = storeName;
+ this.initialKey = initialKey;
+ this.initialValue = initialValue;
+ }
+
+ @Override
+ public void init(final ProcessorContext<Void, Void> context) {
+ store = context.getStateStore(storeName);
+ store.put(initialKey, initialValue);
+ }
+
+ @Override
+ public void process(final Record<String, String> record) {
+ store.put(record.key(), record.value());
Review Comment:
Because it can be reused in future tests and because it honors the name of
the inner class (`StatefulProcessorWithInitialization`), I believe it is better
to keep it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]