Skip to content

Commit

Permalink
Add protocol dto classes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Kindrat committed Nov 14, 2015
1 parent b007725 commit ac9d5e6
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.nginate.kafka;

import com.github.nginate.kafka.core.ClusterMetadata;
import com.github.nginate.kafka.protocol.Partition;
import com.github.nginate.kafka.dto.Partition;

import java.io.Closeable;
import java.net.InetAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.nginate.kafka.core;

import com.github.nginate.kafka.protocol.KafkaNode;
import com.github.nginate.kafka.protocol.Partition;
import com.github.nginate.kafka.protocol.TopicPartition;
import com.github.nginate.kafka.dto.KafkaNode;
import com.github.nginate.kafka.dto.Partition;
import com.github.nginate.kafka.dto.TopicPartition;
import lombok.Synchronized;

import javax.annotation.concurrent.ThreadSafe;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.nginate.kafka.protocol;
package com.github.nginate.kafka.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.nginate.kafka.protocol;
package com.github.nginate.kafka.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.nginate.kafka.protocol;
package com.github.nginate.kafka.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.nginate.kafka.exceptions;

public class ApiException extends KafkaException {
private static final long serialVersionUID = 2342116151549303556L;

public ApiException(String message) {
super(message);
}

public ApiException(String message, Throwable cause) {
super(message, cause);
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/github/nginate/kafka/protocol/ApiKeys.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.nginate.kafka.protocol;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ApiKeys {
PRODUCE(0, "produce"),
FETCH(1, "fetch"),
LIST_OFFSETS(2, "list_offsets"),
METADATA(3, "metadata"),
LEADER_AND_ISR(4, "leader_and_isr"),
STOP_REPLICA(5, "stop_replica"),
OFFSET_COMMIT(8, "offset_commit"),
OFFSET_FETCH(9, "offset_fetch"),
CONSUMER_METADATA(10, "consumer_metadata"),
JOIN_GROUP(11, "join_group"),
HEARTBEAT(12, "heartbeat");

/** the perminant and immutable id of an API--this can't change ever */
private final int id;
/** an english description of the api--this is for debugging and can change */
private final String name;

}
5 changes: 5 additions & 0 deletions src/main/java/com/github/nginate/kafka/protocol/Type.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.github.nginate.kafka.protocol;

public enum Type {
INT8, INT16, INT32, INT64, STRING, BYTES
}

0 comments on commit ac9d5e6

Please sign in to comment.