Skip to content

Commit

Permalink
docs: Update javadocs.
Browse files Browse the repository at this point in the history
Signed-off-by: photowey <[email protected]>
  • Loading branch information
photowey committed Apr 8, 2024
1 parent 2117103 commit 5547885
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
* {@code KafkaPlusProperties}
*
* @author photowey
* @since 2024/04/06
* @version 1.0.0
* @since 2024/04/06
*/
public class KafkaPlusProperties implements Serializable {

public static final String SPRING_KAFKA_PLUS_PROPERTY_PREFIX = "spring.kafkaplus";

private static final long serialVersionUID = 8550578442514111961L;
private static final long serialVersionUID = 3337360099086676508L;

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

Expand All @@ -44,10 +44,25 @@ public static String getPrefix() {

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

/**
* The mode of the Kafka cluster.
*/
private Mode mode = new Mode();
/**
* The bootstrap properties.
*/
private Bootstrap bootstrap = new Bootstrap();
/**
* The admin properties.
*/
private Admin admin = new Admin();
/**
* The consumer properties.
*/
private Consumer consumer = new Consumer();
/**
* The producer properties.
*/
private Producer producer = new Producer();

// ----------------------------------------------------------------
Expand Down Expand Up @@ -81,6 +96,9 @@ public static class Bootstrap implements Serializable {

private static final long serialVersionUID = 1400298527365044251L;

/**
* The {@code bootstrap.servers}.
*/
private String servers = "localhost:9092";

// ----------------------------------------------------------------
Expand All @@ -104,16 +122,30 @@ public void setServers(String servers) {

public static class Admin implements Serializable {

private static final long serialVersionUID = -1451532170849716654L;
private static final long serialVersionUID = -1008246731350725859L;


private List<Topic> topics = new ArrayList<>();

public static class Topic implements Serializable {

private static final long serialVersionUID = -4411325091525328608L;

/**
* The topic name.
*/
private String topic;
/**
* The number of partitions.
*/
private int numPartitions = 1;
/**
* The replication factor.
*/
private int replicationFactor = 1;

/**
* The replicas assignments.
*/
private Map<Integer, List<Integer>> replicasAssignments;

// ----------------------------------------------------------------
Expand Down Expand Up @@ -194,14 +226,26 @@ public static class Consumer implements Serializable {

private static final long serialVersionUID = 6473628614295963537L;

/**
* The key deserializer.
*/
private String keyDeserializer = StringSerializer.class.getName();
/**
* The value deserializer.
*/
private String valueDeserializer = StringSerializer.class.getName();

/**
* The {@code auto.offset.reset}.
*/
private Kafka.Consumer.AutoOffsetReset autoOffsetReset;

/**
* The {@code group.id}.
*/
private String groupId;
/**
* The {@code enable.auto.commit}.
*/
private Boolean autoCommit;

/**
* Subscribes
* |- A,B,C,...,Z
Expand Down Expand Up @@ -291,23 +335,57 @@ public static class Producer implements Serializable {

private static final long serialVersionUID = 8700675817188492332L;

/**
* The key serializer.
*/
private String keySerializer = StringSerializer.class.getName();
/**
* The value serializer.
*/
private String valueSerializer = StringSerializer.class.getName();
/**
* The interceptor.
*/
private String interceptor;
/**
* The partitioner.
*/
private String partitioner;

/**
* The {@code acks}.
*/
private Kafka.Producer.Acks acks;

/**
* The {@code retries}.
*/
private Long retries;

/**
* The {@code batch.size}.
*/
private Long batchSize;
/**
* The {@code buffer.memory}.
*/
private Long bufferMemorySize;

/**
* The {@code linger.ms}.
*/
private Long lingerMs;
/**
* The {@code max.block.ms}.
*/
private Long maxBlockMs;
/**
* The {@code request.timeout.ms}.
*/
private Long requestTimeoutMs;
/**
* The {@code delivery.timeout.ms}.
*/
private Long deliveryTimeoutMs;

/**
* The {@code enable.idempotence}.
*/
private Boolean idempotence;

// ----------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,28 @@
* {@code ApplyObjectMapper}
*
* @author photowey
* @since 2024/04/06
* @version 1.0.0
* @since 2024/04/06
*/
public interface ApplyObjectMapper {

/**
* Init {@link ObjectMapper} instance.
*
* @return {@link ObjectMapper}
*/
default ObjectMapper initObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
this.applyObjectMapper(objectMapper);

return objectMapper;
}

/**
* Apply {@link ObjectMapper}
*
* @param objectMapper {@link ObjectMapper}
*/
default void applyObjectMapper(ObjectMapper objectMapper) {
objectMapper
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
* {@code JacksonDeserializer}
*
* @author photowey
* @since 2024/04/06
* @version 1.0.0
* @since 2024/04/06
*/
public class JacksonDeserializer<T> implements Deserializer<Object>, ApplyObjectMapper {
public class JacksonDeserializer implements Deserializer<Object>, ApplyObjectMapper {

/**
* {@link ObjectMapper}
*/
private final ObjectMapper objectMapper;
/**
* The charsets.
*/
private String encoding = StandardCharsets.UTF_8.name();

public JacksonDeserializer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
* {@code JacksonSerializer}
*
* @author photowey
* @since 2024/04/06
* @version 1.0.0
* @since 2024/04/06
*/
public class JacksonSerializer implements Serializer<Object>, ApplyObjectMapper {

/**
* {@link ObjectMapper}
*/
private final ObjectMapper objectMapper;

public JacksonSerializer() {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<packaging>pom</packaging>

<name>${project.groupId}:${project.artifactId}</name>
<description>An extender of Apache Kafka (the "Kafka").</description>
<description>An extender of Apache Kafka (the "Kafka"), named `kafka-plus` (the "KP").</description>
<url>${io.github.photowey.project.url}</url>

<inceptionYear>2024</inceptionYear>
Expand Down

0 comments on commit 5547885

Please sign in to comment.