Skip to content

Commit 627e578

Browse files
garyrussellartembilan
authored andcommitted
Add reset() to ProducerFactory
1 parent 9581be1 commit 627e578

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaProducerFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ public void onApplicationEvent(ContextStoppedEvent event) {
342342
* {@link Producer}(s).
343343
* @since 2.2
344344
*/
345+
@Override
345346
public void reset() {
346347
try {
347348
destroy();

spring-kafka/src/main/java/org/springframework/kafka/core/ProducerFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,12 @@ default void closeThreadBoundProducer() {
7979
// NOSONAR
8080
}
8181

82+
/**
83+
* Reset any state in the factory, if supported.
84+
* @since 2.4
85+
*/
86+
default void reset() {
87+
// NOSONAR
88+
}
89+
8290
}

spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaProducerFactoryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected Producer createTransactionalProducer(String txIdPrefix) {
110110
@SuppressWarnings({ "rawtypes", "unchecked" })
111111
public void testResetSingle() {
112112
final Producer producer = mock(Producer.class);
113-
DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory(new HashMap<>()) {
113+
ProducerFactory pf = new DefaultKafkaProducerFactory(new HashMap<>()) {
114114

115115
@Override
116116
protected Producer createKafkaProducer() {

0 commit comments

Comments
 (0)