Version: 17.01
Supported Since: 17.01
The database ingress connector can be used to read data from a SQL database in a scheduled manner. The SQL query is pre configured and the parameters for the SQL query can be passed through a configuration file. Simple and advance scheduling strategies can be provided using a cron expression.
DB ingress connector can be used with any relational SQL database system such as Oracle, SQL Server and MySQL databases.
Let’s configure a db ingress connector to read a row from a database table for 5 times in a interval of 30 seconds and print the result set in the console.
Suppose there is a table named as table_1 with 2 columns names as column_1 and column_2. Then the sample integration flow will be as follows.
Sample configuration of the DB ingress connector for the above flow will be as follows.
In order to use the DB Ingress Connector you must first select the “DB” dependency from the connector list when you are creating an empty Ultra project. If you have already created a project, you can add the “DB” dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the connectors list, select the “DB” dependency.
Then you have to configure the resources needed for the database connection in the project.xpml. You can add the data source resource using the "Custom Template" button of the project.xpml designer. Select "Datasource" option and fill the required fields.
Let’s create our integration flow named “SampleFlow” and add a DB IngressConnector to that. Then click on the gear icon appeared on the connector icon to open settings. Set the datasource of the database to read the data from. This datasource was added to the project.xpml in the above prerequisite section.
Here the SQL query should be a SELECT query and other types of queries are not supported by the ingress connector.
Query can be a simple SQL query or an advance one with nested queries. Parameters to the query can be passed using the
@{parameterName}
format.
Now we have configured a datasource for the database to be used and a SQL query with parameters. Then we have to setup the configuration to extract values to replace the parameters. This is done using a mapping file. In this mapping file we have to declare where to extract parameter values from. For the ingress connector, the parameter values are just hard coded to the mapping file itself (In db egress connector and db processing element more options are available). Format of the mapping file is as follows.
{ "parameters":[ { "name": "parameter_1", "type": "VALUE", "value": "value_1" }, { "name": "parameter_2", "type": "VALUE", "value": "value_2" } ] }
This mapping file can be generated using the DB configuration mapping builder.
Processor |
Returns the message received to the Ingress Connector. |
On Exception |
The message will be sent to this outport, if an error occurred while performing the connector operation. |
Data Source |
Basic |
Resource bean for the database connection to be used by the connector. |
Mapping file |
Basic |
File path to the JSON configuration mapping file. |
SQL query |
Basic |
SQL query with parameters. Ex: select column_name_1 from table_name where column_name_2=@{parameter_1} and column_name_3=@{parameter_2} |
Response Timeout |
Advanced |
Timeout in milliseconds after which the request timeouts |
Scheduler Configuration |
Scheduling |
Scheduler configuration bean reference |
Polling CRON Expression |
Scheduling |
CRON expression for polling |
Polling Start Delay (ms) |
Scheduling |
Amount of millis before polling for files from startup of file transport listener. Default value is 1000 |
Polling Repeat Interval (ms) |
Scheduling |
Polling interval in millis. MUST be grater than zero |
Polling Repeat Count: |
Scheduling |
How many times to poll for files. If 0, will run indefinitely. Default value is 1 |
Concurrent Polling Count |
Scheduling |
Maximum concurrent polling tasks. Default value is 1 |
Concurrent Execution Limit |
Scheduling |
Maximum number of concurrent tasks to be executed at a given time. Default value is 4 |