Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
subtletrue
colourYellow
titleThis item is being deprecated.


This stage takes elements from an AspireObject, that are parameters for SQL and executes this SQL against an RDB. The returned rows are then formed in to new AspireObjects and submitted to a pipeline.

The SQL to execute is held in the configuration file and different SQL can be run based on the document action attribute. The configuration allows for parameters to the SQL to be taken from the document. The location of the parameter is given as an XPath.


On this page:

Table of Contents

RDB Sub Job Feeder
Factory Namecom.accenture.aspire:aspire-rdbfeeder
subType

rdbSubJobFeeder

InputsAspireObject and RDB
OutputsAspireObjects containing data from the RDB, published to the configured pipeline manager.

Configuration

ElementTypeDefaultDescription
rdbLocationStringrdbThe location with in the system of the RDB service. Used for database connections.
id/@columnStringNoneThe name of the column that holds the primary key (id) for the row.
extractStringNoneThe various pieces of SQL to run. See below.
eventsStringSee belowThe events to publish documents against. See below.
branches
NoneThe configuration of the pipeline to publish to. See below.

Extract SQL Configuration

The RDB Row Extractor uses configurable SQL to specify what to add to the document. Different SQL may be configured for the different actions that may occur: insert, update and delete.

Accordingly, <action> below may be replace by insert, update or delete.

ElementTypeDefaultDescription
extract/<action>/sqlStringNoneThe SQL to be run to extract data. The SQL may include ? as place holders for parameters. These will then be substituted in in order.
extract/<action>/param/@indexIntegerNoneThe parameter number of this parameter, with parameter one replacing the first ? in the SQL, parameter two replacing the second ? in the SQL etc.
extract/<action>/param/@typeStringIntegerThe type of this parameter - either String or Integer.
extract/<action>/param/@docPathStringNoneThe xpath in the Aspire document to the element that holds the value for this parameter.

Event Configuration

The RDB feeder publishes different actions against different events, meaning different pipelines can be used to handle different actions.

ElementTypeDefaultDescription
events/insert/@eventStringonPublishThe event to publish against for an insert.
events/update/@eventStringonPublishThe event to publish against for an update.
events/delete/@eventStringonDeleteThe event to publish against for a delete.

Branch Configuration

The RDB feeder publishes documents using the branch manager. It publishes using the events configured above. You must therefore include <branches> for these events in the configuration to publish to a pipeline within a pipeline manager. See Branch Handler for more details.

ElementTypeDescription
branches/branch/@eventStringThe event to configure.
branches/branch/@pipelineManagerstringThe URL of the pipeline manager to publish to. Can be relative.
branches/branch/@pipelinestringThe name of the pipeline to publish to.

Example Configuration

  <component name="EM3UpdateSubJobFeeder" subType="rdbSubJobFeeder" factoryName="aspire-rdbfeeder">
    <rdbLocation>/common/EM3rdb</rdbLocation>
    <branches>
      <branch event="onPublish" pipelineManager="../EM3-pipe-manager" pipeline="EM3-add-doc-pipeline" />
      <branch event="onDelete" pipelineManager="../EM3-pipe-manager" pipeline="EM3-del-doc-pipeline"/>
    </branches>
    <id column="ID"/>
    <extract>
      <insert>
        <param index="1" type="int" docPath="/doc/id"/>
        <param index="2" type="string" docPath="/doc/entityType"/>
        <sql>
          <![CDATA[select id, sub1, sub2, sub3 from main
                where ?  = (case ?
                        when 'ma' then mediaAssetId
                        when 'pv' then productVersionId
                        when 'p' then productId
                        when 'pg' then productGroupId
                        else productId
                      end)
          ]]>
        </sql>
      </insert>
      <delete>
        <param index="1" type="int" docPath="/doc/id"/>
        <param index="2" type="string" docPath="/doc/entityType"/>
        <sql>
          <![CDATA[select id from main
                where ?  = (case ?
                        when 'ma' then mediaAssetId
                        when 'pv' then productVersionId
                        when 'p' then productId
                        when 'pg' then productGroupId
                        else productId
                      end)]
          ]>
        </sql>
      </delete>
    </extract>
  </component>