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

Building a Program

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

Download the source code and program package (including function dependencies) to create a function from scratch for converting DIS stream data formats.

Creating a Project

This example uses a Java function to convert the format of DIS stream data. For details about function development, see Developing Functions in Java. The service code is not described.

Download the sample source code package fss_examples_dis_cloudtable_src.zip, decompress the file, and import it to Eclipse, as shown in Figure 1.

Figure 1 Sample code

In the sample code, modify proID (project ID), clusID (cluster ID), and hostName (CloudTable endpoint), and save the modification.

To obtain the project ID, perform the following steps:

  1. Under the current login account in the upper right corner, choose My Credentials, as shown in Figure 2.
  2. Obtain the project ID in the project list, as shown in Figure 3.
Figure 2 My Credentials
Figure 3 Project ID

To obtain the cluster ID, perform the following steps:

  1. Log in to the CloudTable console.
  2. In the navigation pane, choose Cluster Management. Click cluster cloudtable-dis created in Creating a Cluster.
  3. On the cloudtable-dis page that is displayed, find the cluster ID, as shown in Figure 4.
Figure 4 Cluster ID

When creating a function on the FunctionGraph console, set a handler in the format of [package name].[file name].[function name], for example, com.huawei.cff.TableTester.MyHandler for the preceding code.

Packaging the Code

Use Eclipse to package the code into a JAR file named Table Tester.jar according to the following figures.

Figure 5 Exporting the code
Figure 6 Selecting a file type
Figure 7 Publishing the code file

Package the function dependencies by performing the following steps:

  1. Download program package fss_examples_dis_cloudtable.zip, and decompress it, as shown in Figure 8.
  2. Use Table Tester.jar to replace DIS Test.jar, as shown in Figure 9.
  3. Package all of the files into disdemo.zip, as shown in Figure 10.
Figure 8 File directory before replacement
Figure 9 File directory after replacement
Figure 10 Packaging the files in ZIP format

Creating a Function

When creating a function, specify an agency to delegate FunctionGraph to access DIS and CloudTable resources.

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click Create Function.
  3. Select Create from scratch, set the function information, and click Create Function.

    • For Function Type, select Event Function.
    • For Function Name: Enter a function name, for example, DISDemo.
    • For Agency, select DISDemo created in Preparation.
    • For Runtime, select Java 8.

  4. On the function details page, configure the following information:

    • Choose Configuration > Basic Settings, change the handler to com.huawei.cff.TableTester.MyHandler, and click Save.
    • On the Code tab, choose Upload > Local ZIP, upload the disdemo.zip package generated in Packaging the Code.

Modifying Function Configurations

After the function is created, the default memory is 128 MB, and the default timeout is 3s, which are insufficient for the data processing. Perform the following steps to modify the configurations.

  1. On the DISDemo details page, choose Configuration > Basic Settings, and modify the following information as required:

    • For Memory, select 512.
    • For Execution Timeout, enter 15.
    • Keep other parameters unchanged.

  2. Click Save.

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