Subjobs

A subjob specifies the unit of data to replicate. Subjobs can only be run within the context of a job that defines the source and destination locations for the data. Subjobs are, however, independent of jobs in the sense that they can exist on their own without being actually used by a job. In that sense, a subjob can be on the subjob list of zero, one or more jobs.

There are 3 types of subjobs:

  1. Normal: The contents of a database table are replicated as a whole. Normal subjobs are suitable for small tables or cases where entire tables must be replicated like when preloading a new store or a POS. Normal subjobs also support replication counters, where a unique index exists that can be used to select records to be replicated.  This is useful when replicating transactions from POS, so only the newest records will be replicated.
  2. Action: The contents of a database table are replicated by reading a second table, the action table. The action table determines which rows in the main database table have changed and how. Action subjobs are suitable for large tables when you want to minimize data flow by replicating only the changes made in the source location.
  3. Stored Procedure: An action table is read on the source location and for each suitable entry in the action table, a stored procedure is run on the destination locations. Stored procedure subjobs are suitable for replicating business logic transactions implemented through stored procedures.

Normal and action subjobs are always bound to a particular database design for their source database table. This means, for example, that a normal subjob using the Items table in database design A can only be used to replicate data from a distribution location that has database design A assigned to it (see section Using the Scheduler).

Subjobs can be created in the Job view and in the Subjobs list view. To create a subjob from the Subjobs list view go to General setup > Replication > Subjobs.

Click the add button to create a new subjob.

Enter a short description of the subjob and select the replication method to use. You can optionally select an existing subjob to copy settings from. Click OK to continue and open the Subjob view.

The Actions Tab

The fields in the Actions tab are only enabled for action and stored procedure subjobs.

Click the Load Actions button to get a list of actions for the table.

The Replication Counters Tab

The fields in the Replication counters tab are only enabled for normal subjobs.

You can set a subjob to use a replication counter. To use a replication counter the table being replicated must contain a replication counter field. A replication counter field is a not-null integer column that is guaranteed to be unique for all rows in the table. Furthermore, the values in the column must only increase for new values so that when a new row is added to the table it must contain a value greater than all existing replication counter values in the table. Most replication counter fields are defined in MS SQL Server as:

REPLICATIONCOUNTER INT IDENTITY NOT NULL

When a job is run that contains a subjob with a replication counter field, the Scheduler automatically stores the last value of the replication counter field so that it knows where to start replicating the next time the job is run. These values are store per job, subjob and location. These automatically created values are visible at the bottom of the Subjob view.

When performing tests or for some reason you want to retransmit rows based on replication counters, you can edit or delete the replication counters using the edit and add buttons.

The From-table-filters Tab

You can apply filtering to a subjob for specific fields. You then need to select which field to filter by, type of filter to use, filtering value and how the filtering value is interpreted.

 

 

Last updated: 29th November 2016
Version: LS One 2016.1