Skip to content

Commit

Permalink
fix a default method defect in ConsumerFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanQingyangXu committed Dec 16, 2023
1 parent eb68d6d commit 417b876
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2021 the original author or authors.
* Copyright 2018-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@
import java.lang.annotation.Target;

/**
* Annotation to determine the method the should process the DLT topic message.
* Annotation to determine the method that should process the DLT topic message.
* The method can have the same parameters as a {@link KafkaListener} method can (Message, Acknowledgement, etc).
*
* The annotated method must be in the same class as the corresponding {@link KafkaListener} annotation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@
import org.springframework.lang.Nullable;

/**
* The strategy to produce a {@link Consumer} instance(s).
* The strategy to produce a {@link Consumer} instance.
*
* @param <K> the key type.
* @param <V> the value type.
Expand Down Expand Up @@ -79,8 +79,10 @@ default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String
* @return the consumer.
* @since 2.1.1
*/
Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable String clientIdSuffix);
default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable String clientIdSuffix) {
return createConsumer(groupId, clientIdPrefix, clientIdSuffix, null);
}

/**
* Create a consumer with an explicit group id; in addition, the
Expand All @@ -94,11 +96,8 @@ Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientI
* @return the consumer.
* @since 2.2.4
*/
default Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable String clientIdSuffix, @Nullable Properties properties) {

return createConsumer(groupId, clientIdPrefix, clientIdSuffix);
}
Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable String clientIdSuffix, @Nullable Properties properties);

/**
* Return true if consumers created by this factory use auto commit.
Expand Down Expand Up @@ -155,7 +154,6 @@ default boolean removeListener(Listener<K, V> listener) {
* @since 2.5.3
*/
default void addListener(int index, Listener<K, V> listener) {

}

/**
Expand All @@ -164,7 +162,6 @@ default void addListener(int index, Listener<K, V> listener) {
* @since 2.5.3
*/
default void addListener(Listener<K, V> listener) {

}

/**
Expand All @@ -182,7 +179,6 @@ default List<Listener<K, V>> getListeners() {
* @since 2.5.3
*/
default void addPostProcessor(ConsumerPostProcessor<K, V> postProcessor) {

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,6 @@ public void removeConfig(String configKey) {
this.configs.remove(configKey);
}

@Override
public Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable String clientIdSuffix) {

return createKafkaConsumer(groupId, clientIdPrefix, clientIdSuffix, null);
}

@Override
public Consumer<K, V> createConsumer(@Nullable String groupId, @Nullable String clientIdPrefix,
@Nullable final String clientIdSuffixArg, @Nullable Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private static class InternalConfiguration extends Configuration {
private final Configuration delegate;

InternalConfiguration(Map<String, AppConfigurationEntry[]> configurationEntries, Configuration delegate) {
Assert.notNull(configurationEntries, " cannot be null");
Assert.notEmpty(configurationEntries, " cannot be empty");
Assert.notNull(configurationEntries, "'configurationEntries' cannot be null");
Assert.notEmpty(configurationEntries, "'configurationEntries' cannot be empty");
this.configurationEntries = configurationEntries;
this.delegate = delegate;
}
Expand Down

0 comments on commit 417b876

Please sign in to comment.