-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Damian Święcki
committed
Jul 15, 2021
1 parent
2dee9be
commit b1b246a
Showing
5 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
#This configuration auguments and overrides configuration in docker image | ||
#Here we configure OpenAPI based enricher, which is implemented by python service in customerservice | ||
{ | ||
sqlEnricherDbPool { | ||
driverClassName: "org.hsqldb.jdbc.JDBCDriver" | ||
url: "jdbc:hsqldb:file:/opt/nussknacker/storage/db;sql.syntax_ora=true" | ||
username: "sa" | ||
password: "" | ||
} | ||
|
||
processTypes.streaming.modelConfig { | ||
#We add additional jar to model classPath | ||
classPath += "components/openapi.jar" | ||
classPath += "components/openapi.jar" += "components/sql.jar" | ||
components.openAPI { | ||
url: "http://customerservice:5000/swagger" | ||
rootUrl: "http://customerservice:5000" | ||
categories: ["Default"] | ||
} | ||
|
||
components.databaseEnricher { | ||
categories: ["Default"] | ||
config: { | ||
databaseQueryEnrichers: [ | ||
{ name: "db-query", dbPool: ${sqlEnricherDbPool} } | ||
] | ||
databaseLookupEnrichers: [ | ||
{ name: "db-lookup", dbPool: ${sqlEnricherDbPool} } | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Overview | ||
======== | ||
|
||
Nussknacker `Sql` enricher can connect to SQL databases with HikariCP JDBC connection pool. | ||
|
||
It supports: | ||
|
||
- real time database lookup - a simplified mode where you can select from table filtering for a specified key. | ||
- generic DDM/DDL query enricher | ||
- both `databaseQueryEnricher` as well as `databaseLookupEnricher` can cache queries results | ||
- you can specify cache TTL (Time To Live) duration via `Cache TTL` property | ||
- for `databaseQueryEnricher` you can specify `Result Strategy` | ||
- `Result set` - for retrieving whole query result set | ||
- `Single result` for retrieving single value | ||
|
||
Configuration | ||
============= | ||
|
||
Sample configuration: | ||
|
||
You have to configure database connection pool you will be using in your sql enricher | ||
|
||
``` | ||
myDatabasePool { | ||
driverClassName: ${dbDriver} | ||
url: ${myDatabaseUrl} | ||
username: ${myDatabaseUser} | ||
password: ${myDatabasePassword} | ||
timeout: ${dbConnectionTimeout} | ||
initialSize: ${dbInitialPoolSize} | ||
maxTotal: ${dbMaxPoolSize} | ||
} | ||
``` | ||
|
||
| Parameter | Required | Default | Description | | ||
| ---------- | -------- | ------- | ----------- | | ||
| url | true | | URL with your database resource | | ||
| username | true | | Authentication username | | ||
| password | true | | Authentication password | | ||
| driverClassName | true | | Database driver class name | | ||
| timeout | false | 30s | Connection timeout | | ||
| maxTotal | false | 10 | Maximum pool size | | ||
| initialSize | false | 0 | Minimum idle size | | ||
|
||
Next you have to configure component itself. | ||
|
||
You can have multiple databaseQueryEnrichers and databaseLookupEnrichers for multiple various database connections. You | ||
can also specify only one of them. | ||
|
||
``` | ||
components { | ||
yourUniqueComponentName: { | ||
type: databaseEnricher #this defines your component type | ||
config: { | ||
databaseQueryEnrichers: [ | ||
{ name: "myDatabaseQuery", dbPool: ${myDatabasePool} } | ||
] | ||
databaseLookupEnrichers: [ | ||
{ name: "myDatabaseLookup", dbPool: ${myDatabasePool} } | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
| Parameter | Required | Default | Description | | ||
| ---------- | -------- | ------- | ----------- | | ||
| databaseQueryEnrichers | true | | List of database query enrichers components | | ||
| databaseLookupEnrichers | true | | List of database lookup components | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters