Azure CosmosDB

Saiba mais sobre o conector Azure CosmosDB e como usá-lo na Digibee Integration Platform.

Azure CosmosDB lê e escreve registros no banco de dados CosmosDB da plataforma cloud Azure.

Este conector suporta apenas bancos de dados NoSQL. Para bancos de dados MongoDB, por favor use o conector MongoDB.

Parâmetros

Dê uma olhada nos parâmetros de configuração do conector. Parâmetros suportados por expressões Double Braces estão marcados com (DB).

Aba General

Parâmetro
Descrição
Valor padrão
Tipo de dado

Account

A conta usada para conectar ao CosmosDB. Tipo de conta compatível: Secret Key.

N/A

Account

Database Endpoint (DB)

O endpoint do banco de dados Azure Cosmos ao qual o conector irá se conectar.

N/A

String

Operation

A operação do CosmosDB a ser utilizada. Opções:

  • Create Item

  • Delete Item

  • Query Items

  • Read Item

  • Replace Item

  • Upsert Item

Create Item

String

Database Name (DB)

O nome do banco de dados Cosmos ao qual o conector deve se conectar.

N/A

String

Container Name (DB)

O nome do container Cosmos ao qual o conector deve se conectar.

N/A

String

Query (DB)

Tipo de consulta SQL. Disponível na operação Query Items.

N/A

String

Container Partition Key Path (DB)

O caminho da chave de partição do container. Disponível na operação Create Item.

N/A

String

Item Id (DB)

O ID do item. Disponível nas operações Delete Item, Read Item e Replace Item.

N/A

String

Item Partition Key (DB)

O valor da chave de partição no serviço de banco de dados Azure CosmosDB. Uma chave de partição identifica a partição na qual o item está armazenado. Disponível nas operações Create Item, Delete Item, Read Item, Replace Item e Upsert Item.

N/A

String

Body (DB)

O corpo da requisição. Disponível nas operações Create Item, Replace Item e Upsert Item.

{{ message.$ }}

JSON

Fail On Error

Se a opção for ativada, a execução do pipeline com erro será interrompida. Caso contrário, a execução do pipeline continua, mas o resultado mostrará um valor falso para a propriedade "success".

False

Booleano

Aba Optional

Parâmetro
Descrição
Valor padrão
Tipo de dado

Consistency Level

Especifica o nível de consistência para operações do CosmosDB, que deve ser igual ou mais fraco que o nível da conta do banco de dados. As opções, da mais forte para a mais fraca, são Strong, Bounded Staleness, Session, Consistent Prefix e Eventual. Para mais detalhes, consulte a documentação sobre níveis de consistência.

Session

String

Client Telemetry Enabled

Ativa a telemetria para coletar estatísticas sobre operações de banco de dados e dados do sistema (por exemplo, CPU e memória) em intervalos regulares, ajudando na solução de problemas.

False

Boolean

Connection Sharing Across Clients Enabled

Permite que vários clientes Cosmos no mesmo JVM compartilhem conexões no modo Direct ao acessar várias contas Cosmos. Nota: as configurações de conexão do primeiro cliente serão aplicadas a todos os outros clientes.

False

Boolean

Content Response On Write Enabled

Se ativado, as respostas do Cosmos DB para operações de Create, Update e Delete incluirão apenas cabeçalhos e código de status, omitindo o conteúdo.

True

Boolean

Multiple Write Regions Enabled

Permite gravações em qualquer região para contas de banco de dados georredundantes. Quando ativado, o SDK direciona as gravações para regiões graváveis disponíveis, seguindo a ordem do parâmetro Preferred Regions.

True

Boolean

Preferred Regions (DB)

Especifica as regiões preferenciais para contas de banco de dados georredundantes, como uma lista separada por vírgulas (por exemplo, "East US").

N/A

String

Read Requests Fallback Enabled

Permite leituras de múltiplas regiões para contas com configurações de várias regiões.

True

Boolean

Aba Documentation

Parâmetro
Descrição
Valor padrão
Tipo de dado

Documentation

Seção para documentar qualquer informação necessária sobre a configuração do conector e regras de negócio.

N/A

String

Operações

Create Item

Cria um item no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Container Partition Key Path

  • Item Partition Key

  • Body

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Container Partition Key Path: partition

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "Create All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 159,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Saída

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29008962-0000-0b00-0000-672908970000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.718, x-ms-session-token=0:-1#484, lsn=484, x-ms-request-charge=11.62, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=2, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=334;documentsCount=301;collectionSize=413;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=483, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=483, x-ms-activity-id=cbfbb673-9ad4-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=483, x-ms-cosmos-llsn=484, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29008962-0000-0b00-0000-672908970000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "201"
  }
}

Delete Item

Exclui um item no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

Saída

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": null,
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.862, x-ms-session-token=0:-1#493, lsn=493, x-ms-request-charge=11.62, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=21, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=365;documentsCount=300;collectionSize=444;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=492, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=492, x-ms-activity-id=a9f74180-9ae0-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=492, x-ms-cosmos-llsn=493, x-ms-documentdb-partitionkeyrangeid=0, x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "204"
  }
}

Query Items

Consulta itens no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Query

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Query: "SELECT * FROM c"

Saída

{
  "success": true,
  "body": {
    "result": [
      {
        "id": "4E4B38CB-0D82-43E5-89AF-20270CD28A04",
        "categoryId": "75BF1ACB-168D-469C-9AA3-1FD26BB4EA4C",
        "categoryName": "Bikes, Touring Bikes",
        "sku": "BK-T44U-60",
        "name": "Touring-2000 Blue, 60",
        "description": "The product called \"Touring-2000 Blue, 60\"",
        "price": 1214.85,
        "tags": [
          {
            "id": "89FB612A-F9AA-4196-B5F5-B9FA16D558DC",
            "name": "Tag-175"
          },
          {
            "id": "A30014DE-B012-4049-B456-4630527AF47F",
            "name": "Tag-9"
          },
          {
            "id": "B18FB652-C4B6-4A40-BA22-1E687C1A58CE",
            "name": "Tag-161"
          },
          {
            "id": "C6AB3E24-BA48-40F0-A260-CB04EB03D5B0",
            "name": "Tag-73"
          }
        ],
        "_rid": "T0kSAIhFqysBAAAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysBAAAAAAAAAA==/",
        "_etag": "\"010007a9-0000-0b00-0000-6717edb20000\"",
        "_attachments": "attachments/",
        "_ts": 1729621426
      },
      {
        "id": "58978B2E-D4C6-4D69-A840-D935688F9C2D",
        "categoryId": "3E4CEACD-D007-46EB-82D7-31F6141752B2",
        "categoryName": "Components, Road Frames",
        "sku": "FR-R92R-56",
        "name": "HL Road Frame - Red, 56",
        "description": "The product called \"HL Road Frame - Red, 56\"",
        "price": 1431.5,
        "tags": [
          {
            "id": "3A3A99B6-E3BF-46D0-BAD9-F5F4DBB720F4",
            "name": "Tag-70"
          },
          {
            "id": "66D8EA21-E1F0-471C-A17F-02F3B149D6E6",
            "name": "Tag-83"
          },
          {
            "id": "69212884-78CF-48C9-A5C6-B62E76725533",
            "name": "Tag-104"
          },
          {
            "id": "A9834752-41CA-47F5-8A5A-D9A878DF0ACB",
            "name": "Tag-198"
          },
          {
            "id": "D5887E7C-B916-4AF4-BAF8-7B996ADA8C83",
            "name": "Tag-52"
          }
        ],
        "_rid": "T0kSAIhFqysCAAAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysCAAAAAAAAAA==/",
        "_etag": "\"010008a9-0000-0b00-0000-6717edb20000\"",
        "_attachments": "attachments/",
        "_ts": 1729621426
      }
           {
        "id": "E681778F-8359-468B-98F9-4D325D6C377F",
        "categoryId": "C3C57C35-1D80-4EC5-AB12-46C57A017AFB",
        "categoryName": "Clothing, Jerseys",
        "sku": "SJ-0194-S",
        "name": "Short-Sleeve Classic Jersey, S",
        "description": "The product called \"Short-Sleeve Classic Jersey, S\"",
        "price": 53.99,
        "tags": [
          
        ],
        "_rid": "T0kSAIhFqysOAQAAAAAAAA==",
        "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysOAQAAAAAAAA==/",
        "_etag": "\"010015aa-0000-0b00-0000-6717edb40000\"",
        "_attachments": "attachments/",
        "_ts": 1729621428
      }

Read Item

Lê um item no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

Saída

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29008962-0000-0b00-0000-672908970000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:07:54.126 GMT, x-ms-request-duration-ms=0.228, x-ms-session-token=0:-1#485, lsn=485, x-ms-request-charge=1.0, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=9, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=363;documentsCount=301;collectionSize=442;, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-activity-id=9db50cb4-9ade-11ef-8442-9588d1808a88, x-ms-cosmos-item-llsn=484, x-ms-xp-role=1, x-ms-global-Committed-lsn=485, x-ms-item-lsn=484, x-ms-cosmos-llsn=485, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29008962-0000-0b00-0000-672908970000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  },
  "body": {
    "result": {
      "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
      "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
      "categoryName": "Accessories, Bike Stands",
      "sku": "ST-1401",
      "name": "Create All-Purpose Bike Stand",
      "description": "XXXX The product called \"All-Purpose Bike Stand\"",
      "price": 159,
      "tags": [
        {
          "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
          "name": "Tag-101"
        },
        {
          "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
          "name": "Tag-72"
        },
        {
          "id": "5A94DABD-FD34-48F7-9626-50872E214275",
          "name": "Tag-181"
        },
        {
          "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
          "name": "Tag-170"
        },
        {
          "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
          "name": "Tag-8"
        }
      ],
      "_rid": "T0kSAIhFqytpAQAAAAAAAA==",
      "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqytpAQAAAAAAAA==/",
      "_etag": "\"29008962-0000-0b00-0000-672908970000\"",
      "_attachments": "attachments/",
      "_ts": 1730742423
    }
  }
}

Replace Item

Substitui um item no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

  • Body

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "XXXX All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 15,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Saída

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"290028b5-0000-0b00-0000-67291b9f0000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.928, x-ms-session-token=0:-1#490, lsn=490, x-ms-request-charge=11.05, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=15, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=365;documentsCount=299;collectionSize=444;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=489, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=489, x-ms-activity-id=23624866-9ae0-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=489, x-ms-cosmos-llsn=490, x-ms-documentdb-partitionkeyrangeid=0, etag=\"290028b5-0000-0b00-0000-67291b9f0000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  }
}

Upsert Item

Cria ou atualiza um item no CosmosDB. Forneça:

  • Database Name

  • Container Name

  • Item Id

  • Item Partition Key

  • Body

Exemplo

  • Database Name: SampleDB

  • Container Name: SampleContainer

  • Item Id: 57162988-2621-4a1f-b9f4-629f63ec6bb2

  • Item Partition Key: 340D259D-BFFE-4E2A-9C5E-8B1E473A0322

  • Body:

{
    "id": "57162988-2621-4a1f-b9f4-629f63ec6bb2",
    "categoryId": "340D259D-BFFE-4E2A-9C5E-8B1E473A0322",
    "categoryName": "Accessories, Bike Stands",
    "sku": "ST-1401",
    "name": "XXXX All-Purpose Bike Stand",
    "description": "XXXX The product called \"All-Purpose Bike Stand\"",
    "price": 160,
    "tags": [
        {
            "id": "2CE9DADE-DCAC-436C-9D69-B7C886A01B77",
            "name": "Tag-101"
        },
        {
            "id": "304041C4-8C80-4C1E-9EE9-8A1DEFCF39FC",
            "name": "Tag-72"
        },
        {
            "id": "5A94DABD-FD34-48F7-9626-50872E214275",
            "name": "Tag-181"
        },
        {
            "id": "6167EE62-5458-45B8-822D-1C10F274D9F1",
            "name": "Tag-170"
        },
        {
            "id": "7337386B-E865-4ADC-BA17-4437CB02E3BE",
            "name": "Tag-8"
        }
    ],
    "_rid": "T0kSAIhFqysEAAAAAAAAAA==",
    "_self": "dbs/T0kSAA==/colls/T0kSAIhFqys=/docs/T0kSAIhFqysEAAAAAAAAAA==/",
    "_etag": "\"01000aa9-0000-0b00-0000-6717edb20000\"",
    "_attachments": "attachments/",
    "_ts": 1729621426
}

Saída

{
  "success": true,
  "headers": {
    "CamelAzureCosmosDbEtag": "\"29009dae-0000-0b00-0000-67291a490000\"",
    "CamelAzureCosmosDbResponseHeaders": "{x-ms-current-replica-set-size=4, x-ms-last-state-change-utc=Wed, 30 Oct 2024 20:06:24.116 GMT, x-ms-request-duration-ms=3.223, x-ms-session-token=0:-1#487, lsn=487, x-ms-request-charge=11.05, x-ms-content-path=T0kSAIhFqys=, x-ms-schemaversion=1.18, x-ms-transport-request-id=10, x-ms-alt-content-path=dbs/SampleDB/colls/SampleContainer, x-ms-number-of-read-regions=0, x-ms-resource-usage=documentSize=0;documentsSize=363;documentsCount=299;collectionSize=442;, x-ms-current-write-quorum=3, x-ms-cosmos-quorum-acked-llsn=486, x-ms-resource-quota=documentSize=51200;documentsSize=52428800;documentsCount=-1;collectionSize=52428800;, x-ms-quorum-acked-lsn=486, x-ms-activity-id=579d849b-9adf-11ef-8442-9588d1808a88, x-ms-xp-role=1, x-ms-global-Committed-lsn=486, x-ms-cosmos-llsn=487, x-ms-documentdb-partitionkeyrangeid=0, etag=\"29009dae-0000-0b00-0000-67291a490000\", x-ms-serviceversion= version=2.14.0.0}",
    "CamelAzureCosmosDbStatusCode": "200"
  }

Atualizado