Skip to content

Commit

Permalink
High-level consumer abstraction #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Kindrat committed Nov 14, 2015
1 parent b0e74dc commit 68cfa6b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/github/nginate/kafka/KafkaMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.nginate.kafka;

public interface KafkaMessage<T> {
long getTimestamp();

void setTimestamp(long timestamp);

T getPayload();

void setPayload(T payload);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.github.nginate.kafka.consumer;

public interface KafkaConsumer<T> {
void poll();

void addMessageHandler(MessageHandler<T> messageHandler);

void removeMessageHandler(MessageHandler<T> messageHandler);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.github.nginate.kafka.consumer;

import com.github.nginate.kafka.KafkaMessage;

@FunctionalInterface
public interface MessageHandler<T> {
void onMessage(KafkaMessage<T> message);
}

0 comments on commit 68cfa6b

Please sign in to comment.