Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Computação
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Redes
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
Gerenciamento e governança
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
Cloud Operations Center
Resource Governance Center
Migração
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
Análises
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
IoT
IoT Device Access
Outros
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Segurança e conformidade
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
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Serviços de mídia
Media Processing Center
Video On Demand
Live
SparkRTC
Armazenamento
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Cloud Server Backup Service
Storage Disaster Recovery Service
Scalable File Service
Volume 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
Bancos de dados
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
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Aplicações de negócios
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Data Lake Factory
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Distribuição de conteúdo e computação de borda
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Soluções
SAP Cloud
High Performance Computing
Serviços para desenvolvedore
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
Cloud Application Engine
MacroVerse aPaaS
KooPhone
KooDrive

Consulta de uma tarefa de despejo

Atualizado em 2024-09-10 GMT+08:00

Função

Essa API é usada para consultar uma tarefa de despejo.

Esta API está desatualizada e pode não ser mantida no futuro. Use a API descrita em Consulta de tarefas do Smart Connect.

Método de chamada

Para obter detalhes, consulte Como chamar uma API.

URI

GET /v2/{project_id}/connectors/{connector_id}/sink-tasks/{task_id}

Tabela 1 Parâmetros de URI

Parâmetro

Obrigatório

Tipo

Descrição

project_id

Sim

String

ID do projeto. Para obter detalhes, consulte Obtenção de um ID de projeto.

connector_id

Sim

String

ID de despejo da instância.

Para obter detalhes, consulte Consulta de IDs de instância.

task_id

Sim

String

ID da tarefa de despejo.

Tabela 2 Parâmetros de consulta

Parâmetro

Obrigatório

Tipo

Descrição

topic-info

Não

String

Se a informação do tópico está contida. O valor padrão é false.

Parâmetros de solicitação

Nenhum

Parâmetros de resposta

Código de status: 200

Tabela 3 Parâmetros do corpo de resposta

Parâmetro

Tipo

Descrição

task_name

String

Nome de uma tarefa de despejo.

destination_type

String

Tipo da tarefa de despejo.

create_time

Long

Hora em que a tarefa de despejo é criada.

status

String

Status da tarefa de despejo.

topics

String

Lista de tópicos ou expressão regular de tópicos da tarefa de despejo.

obs_destination_descriptor

obs_destination_descriptor object

Descrição do despejo.

topics_info

Array of topics_info objects

Informação do tópico.

Tabela 4 obs_destination_descriptor

Parâmetro

Tipo

Descrição

consumer_strategy

String

Política de consumo de mensagens:

  • latest: as mensagens são consumidas a partir do final do tópico.
  • earliest: as mensagens são consumidas desde o início do tópico.

O valor padrão é latest.

destination_file_type

String

Formato do arquivo de despejo. Somente text é suportado.

obs_bucket_name

String

Nome do bucket do OBS usado para armazenar os dados.

obs_path

String

Caminho do OBS.

partition_format

String

Estrutura de diretório do arquivo de objeto gravado no OBS. A estrutura de diretórios está no formato yyyy/MM/dd/HH/mm (hora em que a tarefa de despejo foi criada).

  • yyyy: ano.
  • yyyy/MM: ano e mês.
  • yyyy/MM/dd: ano, mês e dia.
  • yyyy/MM/dd/HH: ano, mês, dia e hora.
  • yyyy/MM/dd/HH/mm: ano, mês, dia, hora e minuto. Por exemplo, 2017/11/10/14/49 significa que a estrutura de diretórios é 2017 > 11 > 10 > 14 > 49, onde 2017 é a pasta mais externa.
NOTA:

Depois que os dados são despejados com sucesso, a estrutura do diretório de armazenamento é obs_bucket_path/file_prefix/partition_format. O fuso horário padrão é GMT+08:00.

record_delimiter

String

Delimitador para o arquivo de despejo, que é usado para separar os dados do usuário que são gravados no arquivo de despejo.

Intervalo de valores:

  • Comma (,)
  • Semicolon (;)
  • Vertical bar (|)
  • Newline (\n)
  • NULL

Valor padrão: newline (\n).

deliver_time_interval

Integer

Nenhum arquivo de pacote será gerado se não houver dados dentro de um segmento de tempo.

Intervalo de valores: 30-900. Valor padrão: 300. Unidade: segundo.

NOTA:

Esse parâmetro é obrigatório se os dados de streaming forem despejados no OBS.

obs_part_size

Long

Tamanho (em bytes) de cada arquivo a ser carregado.

Valor padrão: 5242880.

Tabela 5 topics_info

Parâmetro

Tipo

Descrição

topic

String

Nome do tópico.

partitions

Array of partitions objects

Lista de partições.

Tabela 6 partitions

Parâmetro

Tipo

Descrição

partition_id

String

ID da partição.

status

String

Status de execução.

last_transfer_offset

String

Deslocamento de mensagem despejada.

log_end_offset

String

Deslocamento da mensagem.

lag

String

Número de mensagens empilhadas.

Exemplo de solicitação

Consulta de detalhes da tarefa de despejo especificada

GET https://{endpoint}/v2/{project_id}/connectors/{connector_id}/sink-tasks/{task_id}?topic-info=true

Exemplo de resposta

Código de status: 200

Consulta bem-sucedida de uma tarefa de despejo

{
  "task_name" : "obsTransfer-56997523",
  "destination_type" : "OBS",
  "create_time" : 1628126621283,
  "status" : "RUNNING",
  "topics" : "topic-sdk-no-delete",
  "obs_destination_descriptor" : {
    "consumer_strategy" : "earliest",
    "destination_file_type" : "TEXT",
    "obs_bucket_name" : "testobs",
    "obs_path" : "obsTransfer-56997523",
    "partition_format" : "yyyy/MM/dd/HH/mm",
    "record_delimiter" : "",
    "deliver_time_interval" : 300,
    "obs_part_size" : 5242880
  },
  "topics_info" : [ {
    "topic" : "topic-sdk-no-delete",
    "partitions" : [ {
      "partition_id" : "2",
      "status" : "RUNNING",
      "last_transfer_offset" : "3",
      "log_end_offset" : "3",
      "lag" : "0"
    }, {
      "partition_id" : "1",
      "status" : "RUNNING",
      "last_transfer_offset" : "3",
      "log_end_offset" : "3",
      "lag" : "0"
    }, {
      "partition_id" : "0",
      "status" : "RUNNING",
      "last_transfer_offset" : "3",
      "log_end_offset" : "3",
      "lag" : "0"
    } ]
  } ]
}

Código de exemplo do SDK

O código de exemplo do SDK é o seguinte.

Java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.kafka.v2.region.KafkaRegion;
import com.huaweicloud.sdk.kafka.v2.*;
import com.huaweicloud.sdk.kafka.v2.model.*;


public class ShowSinkTaskDetailSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        KafkaClient client = KafkaClient.newBuilder()
                .withCredential(auth)
                .withRegion(KafkaRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowSinkTaskDetailRequest request = new ShowSinkTaskDetailRequest();
        request.withTopicInfo(ShowSinkTaskDetailRequest.TopicInfoEnum.fromValue("<topic-info>"));
        try {
            ShowSinkTaskDetailResponse response = client.showSinkTaskDetail(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkkafka.v2.region.kafka_region import KafkaRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkkafka.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("CLOUD_SDK_SK")

    credentials = BasicCredentials(ak, sk) \

    client = KafkaClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(KafkaRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowSinkTaskDetailRequest()
        request.topic_info = "<topic-info>"
        response = client.show_sink_task_detail(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    kafka "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := kafka.NewKafkaClient(
        kafka.KafkaClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowSinkTaskDetailRequest{}
	topicInfoRequest:= model.GetShowSinkTaskDetailRequestTopicInfoEnum().<TOPIC_INFO>
	request.TopicInfo = &topicInfoRequest
	response, err := client.ShowSinkTaskDetail(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

Código de status

Código de status

Descrição

200

A tarefa de despejo é consultada com sucesso.

Códigos de erro

Consulte Códigos de erro.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Conteúdo selecionado

Envie o conteúdo selecionado com o feedback