Klevr Product Documentation logo

Store Cosmos DB Upsert Stage

The Store Cosmos DB Upsert stage allows Integration Hub to upsert data into a Cosmos DB data store.

Stage Overview

The Store Cosmos DB Upsert stage allows Integration Hub to upsert data into a Cosmos DB data store.

The Store Cosmos DB Upsert stage is only supported when deploying using Standard Logic Apps.

Stage Definition File Location

All Store Cosmos DB Upsert stages are defined by creating an appropriately formatted JSON definition file in the following location:

interfaces
{businessUnitCode}
{domainCode}
{integrationName}
st
cdb
{STAGE_NAME}.json

Stage JSON Definition File Format

The JSON definition file for a Store Cosmos DB Upsert stage is as follows:

{
  "name": "stage-name",
  "operation": "upsert",
  "displayName": "Brief Stage Title",
  "description": "Brief description of the stage.",
  "enabled": "$env:STATUS_<INTEGRATION_NAME>",
  "source": "source-event",
  "concurrency": 10,
  "cdb": {
    "databaseId": "DatabaseID-string-value",
    "containerId": "ContainerID-string-value",
    "connectionString": "$env:CDB_CONNECTION_STRING",
    "isUpsert": boolean
  },
  "useCDN": true,
  "preLogTransformSchemaFileName": "schemas/path/to/schema/schema-name.liquid",
  "preLogTransformSchemaType": "liquid|javascript",
  "preLogTransformFormat": "json|xml|csv"
}
PropertySub-PropertyDescription
nameThe name of the stage.
operationThis must be upsert.
displayNameOptional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability.
descriptionOptional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature.
enabledOptional boolean flag (true or false). Default is true.

Generally set via a DevOps variable. Controls if the stage is deployed enabled or not.
sourceThe source event that the stage subscribes to. See Pub/Sub Model.

Alternatively, sources may be supplied, and an array of one or more source events can be subscribed to.
concurrencyOptional number of concurrent runs permitted for the stage. Default is 10.
cdb
databaseIdThe Cosmos DB Database ID Name. This can be found by navigating to the Cosmos DB resource and looking at the header folder in the data explorer.
containerIdThe Cosmos DB Container ID Name. This can be found by navigating to the Cosmos DB resource and looking at the target container folder in the data explorer.
connectionStringThis value is stored as an environment variable. The connection string can be found by navigating to the Cosmos DB resource and looking in the keys.
isUpsertBoolean value that determines if the insertion of data into Cosmos DB will be via upsert or create.

If this is marked to true, then Integration Hub will use the ID and Partition Key of each record in the upserted file to see if that record already exists. If the record already exists, then the existing record is updated. If the record does not exist, then a new record is created.

When set to false, only new records will be inserted - attempts to insert data that already exists based on the ID and Partition Key will fail.
useCDNOptional boolean flag (true or false). Default is false.

If set to true, when the JSON payload is being stored, the payload will be inspected for URLs that appear to link to images and/or videos. Integration Hub will check and validate if the URLs are valid or not, and if they return valid images and/or videos.

Any valid images and/or videos that are able to be downloaded will be stored in an Azure Storage Account with an associated Azure CDN profile, and the JSON payload will be updated to use the Azure CDN URLs instead of the original URLs for these images and/or videos.

Requires that the deployStorageServices setting for the integration's Domain, as defined in the domains file, be set to true.

Pre-Logging Transformation

This stage supports the optional pre-logging transformation feature using the following fields:

  • preLogTransformSchemaFileName
  • preLogTransformSchemaType
  • preLogTransformFormat

See the Pre-Logging Transformation for details.

Payload Format

The payload to be stored in Cosmos DB:

Last updated on