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

Introduction to SDK APIs

Updated on 2024-11-30 GMT+08:00

SDK defines multiple types of class objects. This section describes the API definitions of these class objects.

  • SubscribeContext
    Table 1 SubscribeContext

    Function Name

    Description

    setDomainName(String domainName)

    Specifies the username.

    The IAM username for creating required subscription tasks.

    setUserId(String userId)

    Specifies the user ID.

    You can obtain the user ID from My Credential on the management console.

    setPassword(String password)

    Specifies the user password.

    The password corresponding to the IAM user or member account.

    setIp(String ip)

    Specifies the IP address of the subscription instance.

    Set this parameter to the IP address located on the Basic Information page of the target subscription task.

  • ClusterClient
    Table 2 ClusterClient

    Function Name

    Description

    void addClusterListener(ClusterListener var1)

    Adds downstream listeners. A listener can subscribe to incremental data only after being added to ClusterClient.

    The ClusterListener arg0 parameter is an object of the ClusterListener arg0 class.

    void start()

    Starts the SDK client to subscribe to incremental data.

    void stop()

    Stop subscribing to incremental data.

  • ClusterListener
    Table 3 ClusterListener

    Function Name

    Description

    void notify(List<ClusterMessage> var1)

    Defines the consumption of incremental data. When receiving data, the SDK informs ClusterListner of consuming data using notify. For example, the consumption mode in SDK Template indicates the subscription data displayed on the screen.

    The input parameter type of this function is List <ClusterMessage> in which ClusterMessage is the structure object of the subscription data storage. For details, see Table 4.

  • ClusterMessage

    Each ClusterMessage stores the data records of an RDS transaction, and each record is stored using Record.

    Table 4 ClusterMessage

    Function Name

    Description

    Record getRecord()

    Obtains a change record from ClusterMessage. The change record indicates each record in the RDS binlog file, such as begin, commit, update, and insert.

  • Record

    Record indicates each record in the RDS binlog file, such as begin, commit, and update.

    Table 5 Record

    Function Name

    Description

    String getAttribute(final String key)

    Obtains the main attribute values in Record. If the input parameter is an attribute name, the value of this attribute is returned.

    Table 6 lists the attribute names and values that can be obtained by invoking this function.

    Type getOpt()

    Obtains the statement type of a record, including insert, delete, update, replace, ddl, begin, commit, and heartbeat.

    String getCheckpoint()

    Obtains the checkpoint of the change record in the binlog. The returned value is in the following format: binlog_offset@binlog_fid.

    binlog_offset indicates the offset of the change record in the binlog file, and binlog_fid indicates the numeric suffix of the binlog file. For example, if the binlog file name is mysql-bin.00092, the value of binlog_fid is 92.

    int getFieldCount()

    Obtains the number of Fields in the change record.

    List <Field> getFieldList()

    The data type of the returned value of this function is List <Field>.

    List <Field> contains the definitions of all fields of the change record and the image values before and after the change. For details about the definition of Field, see Table 7.

    Table 6 Attribute information

    key

    Description

    record_id

    Specifies the record ID. The ID number does not ascend during the subscription process.

    instance

    Specifies the DB instance connection address of the record. The format is ip:port.

    source_type

    Specifies the DB engine type of the record. The current DB engine is MySQL.

    source_category

    Specifies the record type. The current value is full_recorded.

    timestamp

    Specifies the time when the record is written to the binlog. It is also the time when the SQL statement is executed in RDS.

    checkpoint

    Specifies the binlog file checkpoint of the record. The format is :file_offset@file_name. The parameter file_name, indicate the numeric suffix of the binlog file.

    record_type

    Specifies the operation type of the record. The values include: insert, update, delete, replace, ddl, begin, commit, and heartbeat.

    db

    Specifies the database name updated in the record.

    table_name

    Specifies the table name updated in the record.

    record_recording

    Specifies the record code.

    seqno

    Specifies the data point. It is used to specify a data point of a DRS task.

    fragno

    Specifies a reserved field. In the earlier version, this field is used to determine whether a transaction shard is used. In this version, this field is meaningless.

    isLastFrag

    Specifies a reserved field. In the earlier version, this field is used to determine whether the record is the last record of a transaction. In this version, this field is meaningless.

  • Field

    The Field class defines the attributes of each field, such as the code, type, field name, field value, and whether the field is a primary key. Table 7 describes the API of each Field class.

    Table 7 Field

    Function Name

    Description

    String getEncoding()

    Obtains the encoding format of the field value.

    String getFieldname()

    Obtains the name of this field.

    Type getType()

    Obtains the data type of the field. For details, see the field type definition.

    ByteString getValue()

    Obtains the value of this field. The returned type is ByteString. If the value is null, NULL is returned.

    Boolean isPrimary()

    Checks whether the field is the primary key column of the table. If yes, True is returned. Otherwise, False is returned.

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