Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Adaptation to the Native KafkaConsumer API

Updated on 2022-02-22 GMT+08:00
Table 1 API adaptation description

Native KafkaConsumer

Type

DISKafkaConsumer

Description

Set<TopicPartition> assignment()

API

Supported

Obtain information about the consumed stream and partition.

Set<String> subscription()

API

Supported

Obtain the name of the stream that has been subscribed to by the consumer.

void assign(Collection<TopicPartition> var1)

API

Supported

Allocate a specified partition.

void subscribe(Collection<String> var1)

API

Supported

Subscribe to a specified stream.

void subscribe(Collection<String> var1, ConsumerRebalanceListener var2)

API

Supported

Subscribe to a specified stream and supports callback of ConsumerRebalanceListener.

void subscribe(Pattern var1, ConsumerRebalanceListener var2)

API

Supported

Subscribe to all streams that match wildcards and supports callback of ConsumerRebalanceListener.

void unsubscribe()

API

Supported

Cancels all subscription.

ConsumerRecords<K, V> poll(long var1)

API

Supported

The message is obtained.

Checksum (CRC32 check value of the message), serializedKeySize (byte length after key serialization), and serializedValueSize (byte length after key serialization).

void commitSync()

API

Supported

Commit the consumed offsets synchronously.

void commitSync(final Map<TopicPartition, OffsetAndMetadata> offsets)

API

Supported

Commit the specified offset synchronously.

void commitAsync()

API

Supported

Commit the consumed offsets asynchronously.

public void commitAsync(OffsetCommitCallback callback)

API

Supported

Commit the current consumed offset asynchronously and supports callback of OffsetCommitCallback.

void commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback)

API

Supported

Commit the specified offset asynchronously and supports callback of OffsetCommitCallback.

void seek(TopicPartition partition, long offset)

API

Supported

Set the specified offset for a partition.

void seekToBeginning(Collection<TopicPartition> partitions)

API

Supported

Set the earliest value for the partition offset.

void seekToEnd(Collection<TopicPartition> partitions)

API

Supported

Set the latest value for the partition offset.

long position(TopicPartition partition)

API

Supported

Obtain the offset of the current consumed data in the partition.

OffsetAndMetadata committed(TopicPartition partition)

API

Supported

Obtain the committed offset of the partition.

List<PartitionInfo> partitionsFor(String topic)

API

Supported

Obtain the partition information of the stream, but leader, replicas, and inSyncReplicas in PartitionInfo are not implemented.

Map<String, List<PartitionInfo>> listTopics()

API

Supported

Obtain the stream information, but leader, replicas, and inSyncReplicas in PartitionInfo are not implemented.

void pause(Collection<TopicPartition> partitions)

API

Supported

Suspends the partition consumption.

void resume(Collection<TopicPartition> partitions)

API

Supported

Resumes the partition consumption.

Set<TopicPartition> paused()

API

Supported

Obtain all partitions that stop being consumed.

close()

API

Supported

Disable the consumer.

Map<MetricName, ? extends Metric> metrics()

API

Not supported

Obtain statistics.

wakeup()

API

Not supported

The internal implementation principles are different.

group.id

Parameter

Supported

Consumer group ID.

client.id

Parameter

Supported

client.id of each consumer must be unique. If client.id is not specified, the dis kafka consumer will generate a UUID as a client.id.

key.deserializer

Parameter

Supported

The meaning of this parameter is the same as that in Kafka. The default value is StringDeserializer. In Kafka, StringDeserializer has no default value, and you must configure a value for it.

value.deserializer

Parameter

Supported

The meaning of this parameter is the same as that in Kafka. The default value is StringDeserializer. In Kafka, this parameter has no default value, and you must configure a value for it.

enable.auto.commit

Parameter

Supported

The default value is the same as that in Kafka, which is true.

  • true: The automatic offset committing is enabled and offsets are automatically committed at an interval of auto.commit.interval.ms.
  • false: Offsets are not automatically committed.

auto.commit.interval.ms

Parameter

Supported

Interval for automatically committing offsets, in milliseconds. The default value is 5000.

auto.offset.reset

Parameter

Supported

The default value is the same as that in Kafka, which is latest.

This parameter is used to automatically set the offset position when there is no initial offset or the offset is incorrect.

  • earliest: The offset is automatically reset to the earliest value.
  • latest: The offset is automatically reset to the latest value.
  • none: If the previous offset is not found in the consumer group, an exception is issued to the consumer.

Others

Parameter

Not supported

-

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback