Skip to content

Commit

Permalink
Merge pull request #7 from photowey/release
Browse files Browse the repository at this point in the history
[release] Release v1.1(3.7.0.1.1)
  • Loading branch information
photowey authored Apr 7, 2024
2 parents ccb45a7 + 65e828e commit 09cf690
Show file tree
Hide file tree
Showing 17 changed files with 454 additions and 52 deletions.
2 changes: 1 addition & 1 deletion kafka-plus-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.photowey</groupId>
<artifactId>kafka-plus</artifactId>
<version>3.7.0.1.0</version>
<version>3.7.0.1.1</version>
</parent>

<artifactId>kafka-plus-autoconfigure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion kafka-plus-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.photowey</groupId>
<artifactId>kafka-plus</artifactId>
<version>3.7.0.1.0</version>
<version>3.7.0.1.1</version>
</parent>

<artifactId>kafka-plus-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
*/
public abstract class AbstractBuilder {

/**
* The custom configs.
*/
protected Map<String, Object> configs;

/**
* The custom {@link Properties} configs.
*/
protected Properties props;

protected void initConfigsIfNecessary() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,50 @@
*/
public interface AdminBuilder {

/**
* The {@code bootstrap.servers}.
*
* @param bootstrapServers the bootstrap.servers
* @return {@link AdminBuilder}
*/
AdminBuilder boostrapServers(String bootstrapServers);

/**
* The custom property configs.
*
* @param props the custom property configs.
* @return {@link AdminBuilder}
*/
AdminBuilder props(Properties props);

AdminBuilder configs(Map<String, Object> configMap);
/**
* The custom configs.
*
* @param configs the custom configs.
* @return {@link AdminBuilder}
*/
AdminBuilder configs(Map<String, Object> configs);

/**
* Check custom property configs.
*
* @param fx the callback.
* @return {@link AdminBuilder}
*/
AdminBuilder checkProps(Consumer<Properties> fx);

/**
* Check custom configs.
*
* @param fx the callback.
* @return {@link AdminBuilder}
*/
AdminBuilder checkConfigs(Consumer<Map<String, Object>> fx);

/**
* Build {@link Admin} instance.
*
* @return {@link Admin}
*/
Admin build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,22 @@
* Properties props = new Properties();
* Admin admin = new AdminBuilderImpl()
* .props(props)
* .checkProps((x) -> {})
* .checkProps(x -&gt; {})
* .build();
* </pre>
*
* <pre>
* Map<String, Object> configMap = new HashMap<>();
* Map&lt;String, Object&gt; configMap = new HashMap&lt;&gt;();
* Admin admin = new AdminBuilderImpl()
* .configMap(configMap)
* .checkMap((x) -> {})
* .checkConfigs(x -&gt; {})
* .build();
* </pre>
*
* <pre>
* String bootstrapServers = "localhost:9092";
* Admin admin = new AdminBuilderImpl()
* .boostrapServers(bootstrapServers)
* .checkMap((x) -> {})
* .build();
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,50 @@
*/
public interface NewTopicBuilder {

/**
* The topic name.
*
* @param topic the topic name
* @return {@link NewTopicBuilder}
*/
NewTopicBuilder topic(String topic);

/**
* The numPartitions.
*
* @param numPartitions the num of partitions.
* @return {@link NewTopicBuilder}
*/
NewTopicBuilder numPartitions(Integer numPartitions);

/**
* The replicationFactor.
*
* @param replicationFactor the replication factor.
* @return {@link NewTopicBuilder}
*/
NewTopicBuilder replicationFactor(Integer replicationFactor);

/**
* The replicasAssignments.
*
* @param replicasAssignments the replicas assignments.
* @return {@link NewTopicBuilder}
*/
NewTopicBuilder replicasAssignments(Map<Integer, List<Integer>> replicasAssignments);

/**
* The custom configs.
*
* @param configs the custom configs.
* @return {@link NewTopicBuilder}
*/
NewTopicBuilder configs(Map<String, String> configs);

/**
* Build {@link NewTopic} instance.
*
* @return {@link NewTopic}
*/
NewTopic build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,160 @@
*/
public interface ConsumerBuilder {

/**
* The {@code bootstrap.servers}.
*
* @param bootstrapServers the bootstrap.servers
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder boostrapServers(String bootstrapServers);

/**
* The key deserializer.
*
* @param keyDeserializer the key deserializer Class.
* @param <K> the key type.
* @return {@link ConsumerBuilder}
*/
default <K> ConsumerBuilder keyDeserializer(Class<K> keyDeserializer) {
return this.keyDeserializer(keyDeserializer.getName());
}

/**
* The value deserializer.
*
* @param valueDeserializer the value deserializer Class.
* @param <V> the value type.
* @return {@link ConsumerBuilder}
*/
default <V> ConsumerBuilder valueDeserializer(Class<V> valueDeserializer) {
return this.valueDeserializer(valueDeserializer.getName());
}

/**
* The key deserializer.
*
* @param keyDeserializer the key deserializer.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder keyDeserializer(String keyDeserializer);

/**
* The value deserializer.
*
* @param valueDeserializer the value deserializer.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder valueDeserializer(String valueDeserializer);

/**
* The {@code auto.offset.reset}.
*
* @param offsetReset the {@code auto.offset.reset}
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder autoOffsetReset(Kafka.Consumer.AutoOffsetReset offsetReset);

/**
* The {@code group.id}.
*
* @param groupId the {@code group.id}
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder groupId(String groupId);

/**
* The {@code enable.auto.commit}.
*
* @param enabled the {@code enable.auto.commit}
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder autoCommit(boolean enabled);

// ----------------------------------------------------------------

/**
* The key deserializer.
*
* @param keyDeserializer the key deserializer.
* @param <K> the key type.
* @return {@link ConsumerBuilder}
*/
<K> ConsumerBuilder keyDeserializer(Deserializer<K> keyDeserializer);

/**
* The value deserializer.
*
* @param valueDeserializer the value deserializer.
* @param <V> the value type.
* @return {@link ConsumerBuilder}
*/
<V> ConsumerBuilder valueDeserializer(Deserializer<V> valueDeserializer);

// ----------------------------------------------------------------

/**
* The custom property configs.
*
* @param props the custom property configs.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder props(Properties props);

/**
* The custom configs.
*
* @param configs the custom configs.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder configs(Map<String, Object> configs);

// ----------------------------------------------------------------

/**
* Check custom property configs.
*
* @param fx the callback.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder checkProps(Consumer<Properties> fx);

/**
* Check custom configs.
*
* @param fx the callback.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder checkConfigs(Consumer<Map<String, Object>> fx);

// ----------------------------------------------------------------

/**
* The topics of the consumer subscribe.
*
* @param topics the topic names.
* @return {@link ConsumerBuilder}
*/
default ConsumerBuilder subscribe(String... topics) {
return this.subscribe(new HashSet<>(Arrays.asList(topics)));
}

/**
* The topics of the consumer subscribe.
*
* @param topics the topic names.
* @return {@link ConsumerBuilder}
*/
ConsumerBuilder subscribe(Collection<String> topics);

// ----------------------------------------------------------------

/**
* Build {@link KafkaConsumer} instance.
*
* @param <K> the key type.
* @param <V> the value type.
* @return {@link KafkaConsumer}
*/
<K, V> KafkaConsumer<K, V> build();
}
Loading

0 comments on commit 09cf690

Please sign in to comment.