-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- schema POC
- Loading branch information
Kindrat
committed
Nov 15, 2015
1 parent
6ec8056
commit caec6c3
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/com/github/nginate/kafka/protocol/messages/request/TopicMetadataRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.github.nginate.kafka.protocol.messages.request; | ||
|
||
import com.github.nginate.kafka.protocol.messages.Request; | ||
import com.github.nginate.kafka.protocol.types.Type; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import static com.github.nginate.kafka.protocol.types.TypeName.STRING; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class TopicMetadataRequest extends Request { | ||
/** | ||
* The topics to produce metadata for. If empty the request will yield metadata for all topics. | ||
*/ | ||
@Type(STRING) | ||
private String[] topic; | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/com/github/nginate/kafka/protocol/messages/response/MetadataResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.github.nginate.kafka.protocol.messages.response; | ||
|
||
import com.github.nginate.kafka.protocol.messages.Response; | ||
import com.github.nginate.kafka.protocol.types.Type; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import static com.github.nginate.kafka.protocol.types.TypeName.*; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class MetadataResponse extends Response { | ||
@Type(WRAPPER) | ||
private Broker[] brokers; | ||
@Type(WRAPPER) | ||
private TopicMetadata[] topicMetadata; | ||
|
||
@Data | ||
public static class Broker { | ||
@Type(INT32) | ||
private int nodeId; | ||
@Type(STRING) | ||
private String host; | ||
@Type(INT32) | ||
private int port; | ||
} | ||
|
||
@Data | ||
public static class TopicMetadata { | ||
@Type(INT16) | ||
private int topicErrorCode; | ||
@Type(STRING) | ||
private String topicName; | ||
@Type(WRAPPER) | ||
private PartitionMetadata[] partitionMetadata; | ||
|
||
@Data | ||
public static class PartitionMetadata { | ||
@Type(INT16) | ||
private int partitionErrorCode; | ||
@Type(INT32) | ||
private int partitionId; | ||
/** | ||
* The node id for the kafka broker currently acting as leader for this partition. If no leader exists | ||
* because we are in the middle of a leader election this id will be -1. | ||
*/ | ||
@Type(INT32) | ||
private int leader; | ||
/** | ||
* The set of alive nodes that currently acts as slaves for the leader for this partition. | ||
*/ | ||
@Type(INT32) | ||
private int[] replicas; | ||
/** | ||
* The set subset of the replicas that are "caught up" to the leader | ||
*/ | ||
@Type(INT32) | ||
private int[] isr; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
@Documented | ||
public @interface Type { | ||
TypeName value(); | ||
boolean repeatable() default false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters