Apache Kafka Java APIs

MapR Event Store For Apache Kafka supports these Apache Kafka Java APIs.

Javadoc

As of MapR 6.1, Apache Kafka 1.1 is supported.

The following Admin APIs, org.apache.kafka.clients.admin package, are applicable to MapR support of Apache Kafka. These APIs are supported as of MapR 6.0.1.

Note: For MapR 6.1, the following Apache Kafka API is not supported:
  • deleteRecords()
Note: The AdminClient API options (CreateTopicsOptions, DeleteTopicsOptions, DescribeTopicsOptions, ListTopicsOptions, CreatePartitionsOptions, and DescribeTopicsOptions), are ignored. All of the methods assume that a topic belongs to the default stream unless a stream path is specified in the topic name.
If a default stream name is not specified and the topic path does not contain a stream name, the an exception is reported via the Result object. For example:
  • If the topic name is specified as topic1, then the API assumes the full topic path as /defaultStream:topic1.
  • If the topic name is specified as /defaultStream:topic1, then that will be the full topic path.
Note: The AdminClient default stream configuration parameter is streams.admin.default.stream. See Configuration Parameters for more information.
Table 1. AdminClient API Summary
Modifier and Type Method
static AdminClient create(java.util.Properties props)
static AdminClient create(java.util.Map<java.lang.String,java.lang.Object> conf)
void close()
CreateTopicsResult createTopics(java.util.Collection<NewTopic> newTopics)
DeleteTopicsResult deleteTopics(java.util.Collection<NewTopic> newTopics)
DescribeTopicsResult describeTopics(java.util.Collection<java.lang.String> topicNames)
ListTopicsResult listTopics()
ListTopicsResult listTopics((java.lang.String streamPath))
CreatePartitionsResult createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions)
DescribeClustersResult describeCluster()
Note: For a complete list of supported APIs, see Apache Kafka 1.1 APIs used with MapR Event Store For Apache Kafka (6.1)

The following Consumer APIs, org.apache.kafka.clients.consumer package, are applicable to MapR support of Apache Kafka 1.1. These APIs are supported as of MapR 6.0.1.

Table 2. ConsumerRecord Class
Modifier and Type Method
long timestamp()
long timestamptype()
Table 3. KafkaConsumer Class
Modifier and Type Method
void pause(Collection<TopicPartition> partitions)
void resume(Collection<TopicPartition>partitions)
void seekToBeginning(Collection<TopicPartition>)
void seekToEnd(Collection<TopicPartition>)
void subscribe(Collection<String> topics);
void subscribe(Collection<String> topics, ConsumerRebalanceListener)
void assign(Collection<TopicPartition> partitions)

java.util.Map<TopicPartition,OffsetAndTimestamp>

offsetsForTimes(java.util.Map<TopicPartition,java.lang.Long> timestampsToSearch)

java.util.Map<TopicPartition,java.lang.Long>

beginningOffsets(Collection<TopicPartition>)

java.util.Map<TopicPartition,java.lang.Long>

endOffsets(Collection<TopicPartition> partitions)

ConsumerRecords<K,V>

poll(long timeout)

void

commitSync()

void

commitAsync()

The following consumer interface and classes are applicable to MapR support of Apache Kafka.

  • org.apache.kafka.clients.consumer.ConsumerConfig
  • org.apache.kafka.clients.consumer.ConsumerRebalanceCallback (interface)
  • org.apache.kafka.clients.consumer.ConsumerRecord<K,V>
  • org.apache.kafka.clients.consumer.ConsumerRecords<K,V>
  • org.apache.kafka.clients.consumer.KafkaConsumer<K, V> implements Consumer<K, V>
Note: For a complete list of supported APIs, see Apache Kafka 1.1 APIs used with MapR Event Store For Apache Kafka (6.1)

The following producer interface and classes, org.apache.kafka.clients.producer package, are applicable to MapR support of Apache Kafka 1.1. These APIs are supported as of MapR 6.0.1.

Table 4. Producer API Summary
Modifier and Type Method
java.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record)
void flush()
void close()

The following producer interface and classes are applicable to MapR support of Apache Kafka 0.9.0.

  • org.apache.kafka.clients.producer.Callback (Interface)
  • org.apache.kafka.clients.producer.KafkaProducer<K,V>
  • org.apache.kafka.clients.producer.ProducerConfig
  • org.apache.kafka.clients.producer.ProducerRecord<K,V>
  • org.apache.kafka.clients.producer.RecordMetadata
Note: For a complete list of supported APIs, see Apache Kafka 1.1 APIs used with MapR Event Store For Apache Kafka (6.1)

The following common APIs, org.apache.kafka.clients.common packages, are applicable to MapR support of Apache Kafka 1.0. These APIs are supported as of MapR 6.0.1.

Table 5. Common API Summary
Modifier and Type Method
java.lang.String key()
byte[] value()

The following APIs are applicable to MapR support for Apache Kafka 0.9.0.

  • org.apache.kafka.common.PartitionInfo
    Supported methods in PartitionInfo:
    • int partition()
    • java.lang.String topic()
    • java.lang.String toString()
  • org.apache.kafka.common.serialization.Serializer<T> (Interface)
  • org.apache.kafka.common.serialization.Deserializer<T> (interface)
  • org.apache.kafka.common.TopicPartition
Note: For a complete list of supported APIs, see Apache Kafka 1.1 APIs used with MapR Event Store For Apache Kafka (6.1)