Difference between revisions of "RDB via Snapshots Application Bundle (Aspire 2)"

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here

(Output)
 
Line 5: Line 5:
 
|appBundleName=RDBMS Connector
 
|appBundleName=RDBMS Connector
 
|mavenCoordinates=com.searchtechnologies.aspire:app-rdbms-connector
 
|mavenCoordinates=com.searchtechnologies.aspire:app-rdbms-connector
|versions=2.0
+
|versions={{CurrentVersion2.X}}
 
|typeFlags=scheduled
 
|typeFlags=scheduled
 
}}
 
}}

Latest revision as of 23:33, 8 December 2015

RDB via Snapshots Application Bundle (Aspire 2)
AppBundle Name  RDBMS Connector
Maven Coordinates  com.searchtechnologies.aspire:app-rdbms-connector
Versions  2.2.2
Type Flags  scheduled
Inputs  AspireObject from a content source submitter holding all the information required for a crawl.
Outputs  An AspireObject containing the data extracted from the database to be processed.

The RDB via Snapshots Connector performs full and incremental scans of the rows in one or more tables of a database. Each row extracted from the database will be tagged with one of three possible actions - add, update or delete, so a different Aspire pipeline or job route can differentiate on the task to perform given this action. The exact nature of the extraction method is documented with the RDB via Snapshots Scanner

The connector, once started, can be stopped, paused or resumed sending a new Scanner Configuration Job. Typically the start job will contain all information required by the job to perform the scan. When pausing or stopping, the connector will wait until all the jobs it published have completed before updating the statistics and status of the connector. Pausing a scan will only work in incremental mode - resuming is much like a new incremental feed apart from the fact that the pre update SQL is not run .


Configuration

This section lists all configuration parameters available to install the RDB via Snapshots Application Bundle and to execute crawls using the connector.

General Application Configuration

Property Type Default Description
snapshotDir string ${aspire.home}/snapshots The directory for snapshot files to be stored.
disableTextExtract boolean false By default, connectors use Apache Tika to extract text from downloaded documents. If you wish to apply special text processing to the downloaded document in the workflow, you should disable text extraction. The downloaded document is then available as a content stream.
workflowReloadPeriod int 15m The period after which to reload the business rules. Defaults to ms, but can be suffixed with ms, s, m, h or d to indicate the required units.
workflowErrorTolerant boolean false When set, exceptions in workflow rules will only effect the execution of the rule in which the exception occurs. Subsequent rules will be executed and the job will complete the workflow sucessfully. If not set, exceptions in workflow rules will be re-thrown and the job will be moved to the error workflow.
debug Boolean false Controls whether debugging is enabled for the application. Debug messages will be written to the log files.


Configuration Example

To install the application bundle, add the configuration, as follows, to the <autoStart> section of the Aspire settings.xml.

<application config="com.searchtechnologies.aspire:app-snapshot-rdbms-connector">
  <properties>
    <property name="generalConfiguration">true</property>
    <property name="rdbmsHasDefaults">true</property>
    <property name="rdbmsJDBCUrl">jdbc:mysql://127.0.0.1:3306/test</property>
    <property name="rdbmsJDBCUser">root</property>
    <property name="rdbmsJDBCPassword">encrypted:771FA372D6F46E9F0C058B359683E8CB</property>
    <property name="rdbmsJDBCDriverJar">lib/mysql-connector-java-5.1.27-bin.jar</property>
    <property name="rdbmsJDBCDriverClass"/>
    <property name="snapshotDir">${dist.data.dir}/${app.name}/snapshots</property>
    <property name="workflowReloadPeriod">15s</property>
    <property name="workflowErrorTolerant">false</property>
    <property name="debug">false</property>
  </properties>
</application>

Note: Any optional properties can be removed from the configuration to use the default value described on the table above.

Source Configuration

Scanner Control Configuration

The following table describes the list of attributes that the AspireObject of the incoming scanner job requires to correctly execute and control the flow of a scan process.

Element Type Options Description
@action string start, stop, pause, resume, abort Control command to tell the scanner which operation to perform. Use start option to launch a new crawl.
@actionProperties string full, incremental When a start @action is received, it will tell the scanner to either run a full or an incremental crawl.
@normalizedCSName string Unique identifier name for the content source that will be crawled.
displayName string Display or friendly name for the content source that will be crawled.

Header Example

  <doc action="start" actionProperties="full" actionType="manual" crawlId="0" dbId="0" jobNumber="0" normalizedCSName="FeedOne_Connector"
   scheduleId="0" scheduler="##AspireSystemScheduler##" sourceName="ContentSourceName">
    ...
    <displayName>testSource</displayName>
    ...
  </doc>

All configuration properties described in this section are relative to /doc/connectorSource of the AspireObject of the incoming Job.

Property Type Default Description
rdbmsJDBCUrl string The JDBC URL for your RDBMS server and database. For example, "jdbc:mysql://192.168.40.27/mydb" (MySQL). This will vary depending on the type of RDBMS.
rdbmsJDBCUser string The name of a database user with read-only access to all of the tables which need to be indexed, and write access to the necessary update tables (if update management is handled through the RDB).
rdbmsJDBCPassword string The database password
rdbmsJDBCDriverJar string Path to the JDBC driver JAR file for your RDBMS. Typically this is placed in the "lib" directory inside your Aspire Home, for example "lib/myjdbcdriver.jar".
rdbmsJDBCDriverClass string (Optional)The name of the JDBC driver class if the class name from the META-INF/services/java.sql.Driver file in the driver JAR file should not be used, or that file does not exist in the driver JAR file.
retrievePerBatch boolean Determine if the discoverySQL + extractionSQL have to be used (batching mode). If false then the Scanner will perform a single SQL execution using the fullSQL query.
fullSQL string The SELECT query to be run for retrieve all documents. This query is used for full or incremental scan. The WHERE clause can be used to specify any required condition for crawling the desired documents. For slicing the discoverySQL, add {SLICES} tag to the WHERE clause. For more details, check the wiki.
discoverySQL string The SELECT query to be run for discovering documents. This query is used for full or incremental scan. The WHERE clause can be used to specify any required condition for crawling the desired documents. For slicing the discoverySQL, add {SLICES} tag to the WHERE clause. For more details, check the wiki.
extractionSQL string The SELECT query for extracting data for each document found. It is required to include a WHERE clause that contains, at least, the 'IN' expression. For example: "(...) WHERE idColumnName IN {IDS}", where idColumnName corresponds to unique key field name. {IDS} will be automatically replaced by the connector with the corresponding unique key values.
idColumn string The name of the column which contains unique identifiers for each row. This is used for both full and incremental crawls and must match the name returned by the SQL. If the column is aliased using the SQL "AS" construct, you should provide the alias name here.
idColumnString boolean false True if the ID column is a string.
useSlices boolean false True if you want to divide the Full crawl SQL into multiple slices. Only works when the id column is an integer.
slicesNum integer 10 The number of SQL slices to split Full crawl SQL. Only works when idColumn is an integer.
indexContainers boolean false True if the Tables will be indexed in the crawl.
stopOnError boolean true  (2.2.1 Release)   True if the scan should stop when the JDBC driver throws an error while scanning though the results
waitForSubJobs integer 600000 Timeout value for the crawler's sub-jobs, in milliseconds.
aclMethod string SQL Possible values: column or SQL. Sets whether the ACLs will be retrieved from a column in the extractionSQL or the fullSQL, or if it will be retrieved by the aclSQL.
aclSQL string Retrieves the ACLs for the documents, the result should be in the following format: "domain\user@NT". There must be one row for every ACL on the document

Scanner Configuration Example

<doc action="start" actionProperties="full" normalizedCSName="My_RDB_Source">
  <connectorSource>
	  <useSlices>false</useSlices>
	  <retrievePerBatch>true</retrievePerBatch>
	  <discoverySQL>Select * from main_data</discoverySQL>
	  <extractionSQL>Select * from main_data WHERE ID IN {IDS}</extractionSQL>
	  <idColumn>id</idColumn>
	  <idColumnString>false</idColumnString>
	  <indexContainers>false</indexContainers>
	  <stopOnError>true</stopOnError>
	  <waitForSubJobs>600000</waitForSubJobs>
	  <aclMethod>SQL</aclMethod>
	  <aclSQL>Select 'mydomain\\user@NT' as ACL from main_data</aclSQL>
	</connectorSource>
  <displayName>My RDB Source</displayName>
</doc>

Note: To launch a crawl, the job should be sent (processed/enqueued) to the "/RDBConnector/Main" pipeline.

Output

<doc>
  <url>3</url>
  <id>3</id>
  <displayUrl>3</displayUrl>
  <snapshotUrl>001 3</snapshotUrl>
  <repItemType>aspire/row</repItemType>
  <fetchId>3</fetchId>
  <fetchUrl>3</fetchUrl>
  <rdb>../MultiConnectionPool</rdb>
  <docType>item</docType>
  <sourceName>RBMS_snapshots</sourceName>
  <sourceType>database</sourceType>
  <connectorSource>
    <useSlices>false</useSlices>
    <retrievePerBatch>true</retrievePerBatch>
    <discoverySQL>Select ID from main_data</discoverySQL>
    <extractionSQL>Select ID from main_data WHERE ID IN {IDS}</extractionSQL>
    <idColumn>ID</idColumn>
    <idColumnString>false</idColumnString>
    <indexContainers>false</indexContainers>
    <stopOnError>true</stopOnError>
    <waitForSubJobs>600000</waitForSubJobs>
    <aclMethod>SQL</aclMethod>
    <aclSQL>Select 'mydomain\\user@NT' as ACL from main_data</aclSQL>
    <displayName>RBMS snapshots</displayName>
    <dbUrl>jdbc:mysql://127.0.0.1:3306/test</dbUrl>
    <dbUser>root</dbUser>
    <dbPassword>encrypted:771FA372D6F46E9F0C058B359683E8CB</dbPassword>
    <dbDriverJar>lib/mysql-connector-java-5.1.27-bin.jar</dbDriverJar>
    <dbProps/>
    <dbDriverClass/>
    <contentSourceId>RBMS_snapshots</contentSourceId>
  </connectorSource>
  <action>add</action>
  <connectorSpecific>
    <field name="id">3</field>
  </connectorSpecific>
  <acls>
    <acl access="allow" domain="mydomain" entity="group" fullname="mydomain\user@NT" name="user@NT" scope="global"/>
  </acls>
</doc>