Basics
The table ServiceTenantConfiguration
contains configuration per service in the form of a string with JSON. The configurations database is multi-tenant, meaning it can contain configuration for many tenants.
Start by declaring the tenant:
DECLARE @Organization NVARCHAR(255) = 'acme'
DECLARE @Environment NVARCHAR(255) = '$(Environment)'
Variables
Configuration is very similiar across environments, so working with variables in the sql script is a way to reduce the number of files needed in the repository. In these examples we use the Azure Devops syntax for variables, $(VariableName)
.
Automation
One way to use continous integration for the seeding is like in this guide: Continuous integration for database seeding
Table ServiceTenantConfiguration
The main table to care about is ServiceTenantConfiguration
, which contains configuration for each service:
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, '<service name>', '{
<json>
}')
You can use this table for both Nexus services and your own services.
Configure Nexus services
Fundamentals
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'fundamentals', '{
"AuthenticationConnectionString": "$(AuthenticationConnectionString)",
"LoggerConnectionString": "$(StorageConnectionString)",
"QueueName": "$(LoggerQueueName)"
}')
Property | Comment | |
---|---|---|
AuthenticationConnectionString | Optional | A connection string to an SQL Server database used for Nexus Authentication as a service. |
LoggerConnectionString | Mandatory | Connection string to an Azure storage |
QueueName | Mandatory | Name of the Azure storage queue that will receive log messages |
Async Caller < version 1.4
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'asynccaller', '{
"SchemaVersion": 0,
"ConnectionString": "$(StorageConnectionString)",
"QueueName": "$(AsyncCallerQueueName)",
"DefaultDeadlineTimeSpanInSeconds": 3600
}')
Property | Comment | |
---|---|---|
SchemaVersion | Optional | Defaults to 0 |
ConnectionString | Mandatory | Connection string to an Azure storage |
QueueName | Mandatory | Name of the Azure storage queue that will receive async caller messages |
DefaultDeadlineTimeSpanInSeconds | Optional | For how long Async Caller will try to make the request (Default value is 48 hours) |
Read more here: Async Caller Setup prior to version 1.4.
Async Caller ≥ version 1.4
(This feature is planned for version 1.4.0 of Nexus Async Caller, see Release plan.)
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'asynccaller', '{
"SchemaVersion": 1,
"ConnectionString": "$(StorageConnectionString)",
"DefaultDeadlineTimeSpanInSeconds": 3600,
"Authentication": {
"Methods": [
{
"Id": "nexus",
"AuthorizationType": "JwtFromUrl",
"PostUrl": "https://...fundamentals.../api/v2/Organizations/$(organization)}/Environments/$(environment)/Tokens",
"PostBody": "{ ''ClientId'': ''async-manager'', ''ClientSecret'': ''heimlichkeit'' }",
"ResponseTokenJsonPath": "AccessToken"
}
],
"Originators": [
{
"Name": "businessevents",
"AuthenticationMethod": "nexus",
"TokenUrl": "https://...businessevents.../api/v2/Organizations/$(organization)}/Environments/$(environment)/Tokens/Refresh"
}
]
}
}')
Property | Comment | |
---|---|---|
SchemaVersion | Mandatory | 1 : Pre-defined queue names; support for prioritized queues |
ConnectionString | Mandatory | Connection string to an Azure storage |
DefaultDeadlineTimeSpanInSeconds | Optional | For how long Async Caller will try to make the request (Default value is 48 hours) |
Read more here: Async Caller Setup version 1.4 and onwards.
Business Events
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'businessevents', '{
"ConnectionString": "$(BusinessEventsConnectionString)",
"VerifyPublications": true,
"PublicationIdAtCallback": "$(PublicationIdAtCallback)",
"Clients": [
{
"Name": "client-a",
"Authentication": "standard-authentication"
},
{
"Name": "client-b",
"Authentication": "client-b-authentication",
"RequestHeaders": {
"header-a": "value-a"
}
},
{
"Name": "client-c",
"RequestHeaders": {
"Authorization": "some-custom-auth-mechanism"
}
}
],
"Authentications": [
{
"Id": "standard-authentication",
"AuthorizationType": "JwtFromUrl",
"PostUrl": "' + @IntegrationTestsUrl + '/api/v1/' + @Organization + '/' + @Environment + '/Authentication/Tokens",
"PostBody": "{ ''ClientId'': ''acme-api'', ''ClientSecret'': ''$(AcmeClientPassword)'' }",
"ResponseTokenJsonPath": "AccessToken"
},
{
"Id": "client-b-authentication",
"AuthorizationType": "Basic",
"Username": "$(BEBasicAuthUsername)",
"Password": "$(BEBasicAuthPassword"
}
}
}')
Property | Comment | |
---|---|---|
ConnectionString | Mandatory | A connection string to an SQL Server database used for Nexus Business Events service. |
PublicationIdAtCallback | Optional | Tells Business Events to publish a special event whenever it receives response from a subscriber. Used for integration testing. |
Clients | Optional | A list of subscriber clients that will receiving events on webhooks. See Client Authentication Methods for details about clients and authentication. |
Authentications | Optional | A list of authentication methods used in the integration platform. Referred to by Clients. See Client Authentication Methods for details about clients and authentication. |
[subscriber_client_name]-authentication | Optional | Setup for how Business Events authenticates itself to a client, using the same client name as in the businessevents database. Supported authentication types |
shared-client-authentications | Optional | Setup for how Business Events authenticates itself to clients, when the same method can be used for several subscriber clients. Use one of the Supported authentication types and list the affected clients as a string array under UseForClients . |
VerifyPublications | Optional | Set to "true" to make Business Events service verify the structure and values of all published events. Highly recommended. |
Value translator
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'keytranslator', '{
"ConnectionString": "$(KeyTranslatorConnectionString)"
}')
Property | Comment | |
---|---|---|
ConnectionString | Mandatory | A connection string to an SQL Server database used for Nexus Value Translation service. |
Data Sync engine (Match)
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'match', '{
"ConnectionString": "$(MatchConnectionString)",
"QueueName": "$(AsyncCallerQueueName)",
"DefaultDeadlineTimeSpanInSeconds": 3600
}')
Property | Comment | |
---|---|---|
ConnectionString | Mandatory | A connection string to a SQL Server database used, for Nexus Data Sync service. |
[subscriber client name]-authentication | Optional | Setup for how Data Sync authenticates itself to a client, using the same client name as in the match database. Supported authentication types |
shared-client-authentications | Optional | Setup for how Data Sync authenticates itself to clients, when the same method can be used for several subscriber clients. Use one of the Supported authentication types and list the affected clients as a string array under UseForClients . |
Async Manager
INSERT INTO ServiceTenantConfiguration(Organization, Environment, Service, Configuration)
VALUES (@Organization, @Environment, 'asyncmanager', '{
"AzureStorageConnectionString": "$(StorageConnectionString)",
"DatabaseConnectionString": "$(AsyncManagerConnectionString)",
"PendingQueueName": "pending-request-queue",
"QueueNamePrefix": "am-request-queue",
"PriorityLevels": 1, -- You should probably have at least 3 levels
"DefaultRequestLifetimeInMinutes": 10080,
"AzureStoragePendingContainerName": "pending-request",
"AzureStorageRequestContainerName": "request-payload",
"AzureStorageResponseContainerName": "response-payload",
"ExponentialBackOffFactorInMinutes": 5.0,
"BackOffFirstTimeInSeconds": 15.0,
"PostponeTimeTriggerInMinutes": 60,
"TimeBetweenRequestCompletedAndPurgeInDays": 30,
"PurgeReadBatchSize": 10000,
"PurgeCommitBatchSize": 500,
"SaveRequestPayloadInDb": false, -- true is more convenient but less secure
"SaveResponsePayloadInDb": false, -- true is more convenient but less secure
"SavePayloadsInDb": false, -- true is more convenient but less secure
"SavePayloadsInStorage": true,
"EnqueueBatchSize": 100,
"LimitForEnqueueInsteadOfSleepInSeconds": 300.0,
"LimboTimeLimitInSeconds": 600.0,
"LimitForDeletingCompletedActiveRequestRecordsInDays": 1.0,
"TimeLimitForGetResponseInSeconds": 1.0,
"Authentication": {
"TokenUrl": "https://api.acme.com/Tokens/Refresh",
"Method": {
"AuthorizationType": "JwtFromUrl",
"PostUrl": "https://api.acme.com/Tokens",
"PostBody": "{ ''ClientId'': ''async-manager'', ''ClientSecret'': ''heimlichkeit'' }",
"ResponseTokenJsonPath": "Content.AccessToken"
}
}
}')
Default values are shown in the SQL script above.
Property | Comment | |
---|---|---|
AzureStorageConnectionString |
Mandatory | The connection string for the Azure storage where blobs and queues will be stored. |
DatabaseConnectionString |
Mandatory | The connection string for the Azure SQL server database where relational data will be stored |
PendingQueueName |
Optional | The name of the queue for pending requests |
QueueNamePrefix |
Optional | Each discrete priority queue will have a name that has this string as a prefix, followed by a dash and the the priority level number. If this prefix is "request-queue", then the queues will be named "request-queue-1", "request-queue-2", etc. |
PriorityLevels |
Optional | Based on the Priority property for a request, Nexus Async Manager will make decisions to match the priority, based on the number of priority levels |
DefaultRequestLifetimeInMinutes |
Optional | The default life time for a request, i.e. when should we give up if we the request doesn't succeed |
AzureStoragePendingContainerName |
Optional | The name of the container in which the pending requests will be saved(Default is "pending-request") |
AzureStorageRequestContainerName |
Optional | The name of the container in azure storage in which the response payloads will be saved (Default is "response-payload") |
AzureStorageResponseContainerName |
Optional | The name of the container in azure storage in which the response payloads will be saved (Default is "response-payload") |
ExponentialBackOffFactorInMinutes |
Optional | The factor for the wait time calculation: factor * POW(2, executions-2). The first execution back off time is |
BackOffFirstTimeInSeconds |
Optional | The back off time after the very first execution. |
PostponeTimeTriggerInMinutes |
Optional | When an execution has been postponed, it should not be executed again until it has been triggered; normally when a request that it is waiting for has completed. This property is like a last resort. If we somehow have missed the trigger, this time based trigger will make the execution execute again. |
TimeBetweenRequestCompletedAndPurgeInDays |
Optional | How soon after a request has been completed can it be deleted? |
PurgeReadBatchSize |
Optional | When running stored procedure DeleteSomeOldRequests, this is how many rows will be deleted in total |
PurgeCommitBatchSize |
Optional | When running stored procedure DeleteSomeOldRequests, this is how rows will be deleted in each commit |
SaveRequestPayloadInDb |
Optional | For security reasons, the request payload is saved in another storage than the DB. When this setting is set to true, the payload is ALSO saved in the DB. |
SaveResponsePayloadInDb |
Optional | For security reasons, the response payload is saved in another storage than the DB. When this setting is set to true, the payload is ALSO saved in the DB. |
SavePayloadsInDb |
Optional | By default the request and response payload is saved to db. Set this to false to force storage (blob). |
SavePayloadsInStorage |
Optional | For security reasons, the response payload is saved in another storage than the DB. When this setting is set to true, the payload is ALSO saved in the DB. |
EnqueueBatchSize |
Optional | The number of ActiveRequestRecords that we will enqueue as one transaction. |
LimitForEnqueueInsteadOfSleepInSeconds |
Optional | When a request is planned to be sent in the future, if it is less than this time in the future it will be put on the request queue instead of put to sleep. |
LimboTimeLimitInSeconds |
Optional | If a request has not been updated for this long time period, we will put mark it to be put on the queue again. |
LimitForDeletingCompletedActiveRequestRecordsInDays |
Optional | If an ActiveRequestRecord was completed longer than this ago, it can be deleted. |
TimeLimitForGetResponseInSeconds |
Optional | When calling GET Requests/{id}/Ressponse: In the event of database problems or if the request is in the pending queue, how long time to wait until we give up? |
Authentication |
Optional | To enable support for Refreshing authentication, add this section. When making a request, Nexus Async Manager inspects the access token and if it is missing or expired, it makes a request to TokenUrl of the orginator, to get new credentials. |
Authentication.Methods |
Optional | A request to TokenUrl of an originator requires authentication and one of the Methods will be used to that. See Client authentication methods for supported authentication protocols. |
Authentication.Originators |
Optional | When a request's authenticaton needs renewal, Nexus Async Manager looks for the orginating client in this list. If it is found, the AuthenticationMethod is used to get authentication and then a POST request is made to TokenUrl to get new credentials. TODO: Reference to TokenUrl Contract |