commercetools Connector Project Configuration
Author:
Fluent Commerce
Changed on:
31 Jan 2024
Overview
commercetools Connector Project Configuration
Key points
- Configuration files
- Route Mappings
- Routes
- Listeners
The resource folder of the project contains all build time configurations for the commercetools connector.
- application-connector.yml - Project and Connector specific configuration.
- application.yml - Core Connect SDK configuration. These are mostly default configurations and core settings.
- bootstrap.yml - Server/Container configuration. This file includes settings for all different environments and follows the spring profile standards.
- logback-spring.xml - Log configuration also supports different configurations based on spring profiles.
It is possible to have dedicated configuration files for each environment. This is often used to override a common setting for a particular environment. To create such a file, follow SpringBoot's format having the additional desired spring profile name at the end of the application.yml file, for example, application-dev.yml. More on [Fluent Account Listener Configuration][1].
Property | Description |
connector-name | This is the name of the connector and this property is used to both name the connector as well as build the path of other configuration keys. Keep characters limited to 'a-z' and '-'. |
route-mapping | Routes mappings are used to determine a route for an incoming message. |
routes | Allows new routes to be defined or override existing route configuration. |
listeners | All active listeners for the connector |
credential.credential-manager | Sets the credential manager. When using AWS, keep the value as "aws-secrets-manager" |
job-scheduler.job-scheduler-type | Sets the scheduler manager. Currently, the only possible value is "message-queue" |
Route Mappings
When different kinds of messages (e.g. orders, categories, products, etc…) are received by the connector, it needs to be told how to map each kind to a handler. A handler has a single purpose for example to process orders. The snippet below illustrates a configuration that tells the connector to react to commercetools inbound messages that have the resource type
`“order”`
`“ResourceCreated“`
1 - route: "commercetools.connect.order.create"
2 props:
3 name: "order"
4 inclusion-filter:
5 - "ResourceCreated"
Language: yaml
Name: application-connector.yml
Description:
[Warning: empty required content area]The next step in processing a message is to determine which Fluent retailer this message is for. This is done by taking the project-key from the commercetools message and doing a lookup at the connector Fluent account mapping setting. For more information on how to configure this setting, follow this guide.
Routes
Handlers by default have a predefined route and properties set but it is possible to override them through the configuration files. The example below will show how to override an existing route. To view all available handlers and routes, check Connector Features
1{
2 "route": "batch-inventory-sync",
3 "handler": "InventorySyncJob",
4 "priority": 0,
5 "rops": {
6 "page-size": "500"
7 },
8 "className": "com.fluentcommerce.connect.client.commercetools.handler.job.InventorySyncJobHandler",
9 "description": "Sync inventory details from Fluent to commerceTools"
10}
Language: json
Name: A default route below as an example
Description:
[Warning: empty required content area]It is possible to modify its behaviour by specifying a different property value. Note that if the route name is different from the original one, a new route is created and the original is still valid.
1 routes:
2 job:
3 route: "batch-inventory-sync"
4 handlerName: "InventorySyncJob"
5 props:
6 page-size: "1000"
Language: json
Name: application-connector.yml
Description:
[Warning: empty required content area]The format of this configuration block is as follows:
1 routes:
2 #possible values: job, message or notification
3 job:
4 route: "<route-name>"
5 handlerName: "<handler-name>"
6 props:
7 #this flexible. Consider this is a map of String: String/int/double/long
8 page-size: "1000"
Language: yaml
Name: application-connector.yml
Description:
[Warning: empty required content area]Listeners
There are 4 listeners in this connector
- batch - used to process queued jobs.
- messages - used to queue internal connector messages.
- notification - for internal connector events that require an external notification.
- commercetools_events - queue to receive all commercetools application events. This queue behaves differently from the other queues and it requires a property fluent-account with the Fluent account to be used by the connector. Without this property, this queue will fail to start.