Configuring Connection Details
For the direction and binder name of this Micro-Integration, see Micro-Integration for Azure Cosmos DB .
This section provides instructions for configuring the connection details required to establish communication between the Micro-Integration and your third-party system.
For information about configuring the connection to the event broker, see Step 1: Connecting to Your Event Broker .
For information about configuring error handling, see Step 5: Error Handling.
We recommend starting from the application.yml file provided in the samples/config directory of your downloaded archive, and updating it with the connection details described in this section, rather than building a configuration file from scratch. For more information, see Deploying Your Self-Managed Micro-Integration .
To share settings across all workflows in a Micro-Integration, configure the binder-specific parameters under default at the binder level instead of under a workflow-specific identifier (for example, ) in bindings. This reduces repetition when multiple workflows use the same parameter values. Workflow-specific settings override default settings when both are present.
Note that default is a sibling of bindings; it is not nested under bindings. Use the same hierarchy under default as you use under bindings.<binding-name>. For example, for bindings. the default setting is default..
spring:
cloud:
stream:
<binder-name>:
default:
producer :
<shared parameters>
bindings:
output-0 :
producer :
<workflow-specific parameters>
Azure Cosmos DB Connection Details
To configure the application.yml file:
cosmosdb:
bindings:
output-<workflow-id>:
producer:
endpoint:
query-parameters:
databaseEndpoint: <database-url>
accountKey: <account-key>
containerPartitionKeyPath: <partition-key>
Where:
-
databaseEndpointis the Azure Cosmos DB database endpoint URL, in the following format:localhost:8081orhttps://<account-name>.documents.azure.com:443/ -
accountKeyis the Azure Cosmos DB account key for authentication. -
containerPartitionKeyPathis the name of the payload field to use as the partition key (for example,uniqueId). The partition key determines how data is distributed across partitions in the Azure Cosmos DB container.Hierarchical partition keys are not supported.
You can also specify the following optional query-parameters:
| Parameter | Type | Valid Values | Description |
|---|---|---|---|
container-name
|
String
|
Any valid container name. | The default Azure Cosmos DB container name for operations. |
operation
|
String
|
upsertItem |
The Azure Cosmos DB operation to perform. |
autoDiscoverContainer
|
boolean
|
(true | false)
|
Specifies whether to automatically discover container settings. |
preferredRegions
|
String
|
Comma-separated region names | The preferred Azure regions for Azure Cosmos DB operations. |
Azure Cosmos DB Producer Configuration Options
The following configuration options are available for the Azure Cosmos DB producer.
Prefix this property with spring.cloud.stream.cosmosdb.default.producer.endpoint.:
| Parameter | Type | Valid Values | Description |
|---|---|---|---|
exchange-pattern
|
String
|
InOnly
|
Message exchange pattern. |
Prefix the following properties with spring.cloud.stream.cosmosdb.bindings.output-<workflow-id>.producer.endpoint.:
| Parameter | Type | Valid Values | Description |
|---|---|---|---|
transacted
|
boolean
|
(true | false)
|
Specifies whether to use transacted routes:
|
Connecting to Multiple Systems
To connect to multiple systems of a same type, use the multiple binder syntax.
For example:
spring:
cloud:
stream:
binders:
# 1st solace binder in this example
solace1:
type: solace
environment:
solace:
java:
host: tcp://localhost:55555
# 2nd solace binder in this example
solace2:
type: solace
environment:
solace:
java:
host: tcp://other-host:55555
# The only cosmosdb binder
cosmosdb1:
type: cosmosdb
# Add `environment` property map here if you need to customize this binder.
# But for this example, we'll assume that defaults are used.
# Required for internal use
undefined:
type: undefined
bindings:
input-0:
destination: <input-destination>
binder: solace1
output-0:
destination: <output-destination>
binder: cosmosdb1 # Reference cosmosdb binder
input-1:
destination: <input-destination>
binder: solace2
output-1:
destination: <output-destination>
binder: cosmosdb1 # Reference cosmosdb binder
The configuration above defines two binders of type solace and one binder of type cosmosdb, which are then referenced within the bindings.
Each binder above is configured independently under spring.cloud.stream.binders.<bindername>.environment..
-
When connecting to multiple systems, all binder configuration must be specified using the multiple binder syntax for all binders. For example, under the
spring.cloud.stream.binders.<binder-name>.environment. -
Do not use single-binder configuration (for example,
solace.java.*at the root of yourapplication.yml) while using the multiple binder syntax.