public final class KafkaUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
KafkaUtils.KafkaOffsetMetric |
Modifier and Type | Method and Description |
---|---|
static java.util.List<Partition> |
calculatePartitionsForTask(java.util.List<GlobalPartitionInformation> partitons,
int totalTasks,
int taskIndex) |
static ByteBufferMessageSet |
fetchMessages(KafkaConfig config,
SimpleConsumer consumer,
Partition partition,
long offset)
Fetch messages from kafka
|
static java.lang.Iterable<java.util.List<java.lang.Object>> |
generateTuples(KafkaConfig kafkaConfig,
Message msg,
java.lang.String topic) |
static java.lang.Iterable<java.util.List<java.lang.Object>> |
generateTuples(MessageMetadataSchemeAsMultiScheme scheme,
Message msg,
Partition partition,
long offset) |
static long |
getOffset(SimpleConsumer consumer,
java.lang.String topic,
int partition,
KafkaConfig config) |
static long |
getOffset(SimpleConsumer consumer,
java.lang.String topic,
int partition,
long startOffsetTime) |
static IBrokerReader |
makeBrokerReader(java.util.Map<java.lang.String,java.lang.Object> stormConf,
KafkaConfig conf) |
static java.lang.String |
taskId(int taskIndex,
int totalTasks) |
public static IBrokerReader makeBrokerReader(java.util.Map<java.lang.String,java.lang.Object> stormConf, KafkaConfig conf)
public static long getOffset(SimpleConsumer consumer, java.lang.String topic, int partition, KafkaConfig config)
public static long getOffset(SimpleConsumer consumer, java.lang.String topic, int partition, long startOffsetTime)
public static ByteBufferMessageSet fetchMessages(KafkaConfig config, SimpleConsumer consumer, Partition partition, long offset) throws TopicOffsetOutOfRangeException, FailedFetchException, java.lang.RuntimeException
config
- consumer
- partition
- offset
- TopicOffsetOutOfRangeException
FailedFetchException
java.lang.RuntimeException
public static java.lang.Iterable<java.util.List<java.lang.Object>> generateTuples(KafkaConfig kafkaConfig, Message msg, java.lang.String topic)
public static java.lang.Iterable<java.util.List<java.lang.Object>> generateTuples(MessageMetadataSchemeAsMultiScheme scheme, Message msg, Partition partition, long offset)
public static java.util.List<Partition> calculatePartitionsForTask(java.util.List<GlobalPartitionInformation> partitons, int totalTasks, int taskIndex)
public static java.lang.String taskId(int taskIndex, int totalTasks)