Skip to content

Commit e6faa06

Browse files
GH-2945: Fix a default method in ConsumerFactory
Fixes: #2945 Switch the default assignment for createConsumer method in ConsumerFactory.
1 parent d982c8e commit e6faa06

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

spring-kafka/src/main/java/org/springframework/kafka/annotation/DltHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 the original author or authors.
2+
* Copyright 2018-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
import java.lang.annotation.Target;
2828

2929
/**
30-
* Annotation to determine the method the should process the DLT topic message.
30+
* Annotation to determine the method that should process the DLT topic message.
3131
* The method can have the same parameters as a {@link KafkaListener} method can (Message, Acknowledgement, etc).
3232
*
3333
* The annotated method must be in the same class as the corresponding {@link KafkaListener} annotation.

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
import org.springframework.lang.Nullable;
2828

2929
/**
30-
* The strategy to produce a {@link Consumer} instance(s).
30+
* The strategy to produce a {@link Consumer} instance.
3131
*
3232
* @param <K> the key type.
3333
* @param <V> the value type.
@@ -79,8 +79,10 @@ default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String
7979
* @return the consumer.
8080
* @since 2.1.1
8181
*/
82-
Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
83-
@Nullable String clientIdSuffix);
82+
default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
83+
@Nullable String clientIdSuffix) {
84+
return createConsumer(groupId, clientIdPrefix, clientIdSuffix, null);
85+
}
8486

8587
/**
8688
* Create a consumer with an explicit group id; in addition, the
@@ -94,11 +96,8 @@ Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientI
9496
* @return the consumer.
9597
* @since 2.2.4
9698
*/
97-
default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
98-
@Nullable String clientIdSuffix, @Nullable Properties properties) {
99-
100-
return createConsumer(groupId, clientIdPrefix, clientIdSuffix);
101-
}
99+
Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
100+
@Nullable String clientIdSuffix, @Nullable Properties properties);
102101

103102
/**
104103
* Return true if consumers created by this factory use auto commit.
@@ -155,7 +154,6 @@ default boolean removeListener(Listener<K, V> listener) {
155154
* @since 2.5.3
156155
*/
157156
default void addListener(int index, Listener<K, V> listener) {
158-
159157
}
160158

161159
/**
@@ -164,7 +162,6 @@ default void addListener(int index, Listener<K, V> listener) {
164162
* @since 2.5.3
165163
*/
166164
default void addListener(Listener<K, V> listener) {
167-
168165
}
169166

170167
/**
@@ -182,7 +179,6 @@ default List<Listener<K, V>> getListeners() {
182179
* @since 2.5.3
183180
*/
184181
default void addPostProcessor(ConsumerPostProcessor<K, V> postProcessor) {
185-
186182
}
187183

188184
/**

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,6 @@ public void removeConfig(String configKey) {
352352
this.configs.remove(configKey);
353353
}
354354

355-
@Override
356-
public Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
357-
@Nullable String clientIdSuffix) {
358-
359-
return createKafkaConsumer(groupId, clientIdPrefix, clientIdSuffix, null);
360-
}
361-
362355
@Override
363356
public Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
364357
@Nullable final String clientIdSuffixArg, @Nullable Properties properties) {

spring-kafka/src/main/java/org/springframework/kafka/security/jaas/KafkaJaasLoginModuleInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ private static class InternalConfiguration extends Configuration {
162162
private final Configuration delegate;
163163

164164
InternalConfiguration(Map<String, AppConfigurationEntry[]> configurationEntries, Configuration delegate) {
165-
Assert.notNull(configurationEntries, " cannot be null");
166-
Assert.notEmpty(configurationEntries, " cannot be empty");
165+
Assert.notNull(configurationEntries, "'configurationEntries' cannot be null");
166+
Assert.notEmpty(configurationEntries, "'configurationEntries' cannot be empty");
167167
this.configurationEntries = configurationEntries;
168168
this.delegate = delegate;
169169
}

0 commit comments

Comments
 (0)