Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

PDI Row Distribution Plugin Development

Introduction

A row distribution plugin allows you to distribute rows of data from one step to another in a specific way.

By default there are 2 ways to distribute data (not taking into account partitioning):

  • Distribute rows of data in a round-robin fashion: each target step (copy) gets a row in turn, all target steps get equal amounts of rows
  • Copy rows: all target step (copies) receive all rows.

Sometimes you might have a need to do more specific distribution of the data based on some rule, like the availability of space in the output buffer, the available resources on a machine or some other specific rule.  This is where the row distribution plugins come in.

RowDistributionInterface

Row distribution plugins need to implement the RowDistributionInterface.
Here are the methods that need to be implemented:

  /**
   * @return The row distribution code (plugin id)
   */
  public String getCode();
  
  /**
   * @return The row distribution description (plugin description)
   */
  public String getDescription();
  /**
   * Do the actual row distribution in the step
   * @param rowMeta the meta-data of the row to distribute
   * @param row the data of the row data to distribute
   * @param stepInterface The step to distribute the rows in
   * @throws KettleStepException
   */
  public void distributeRow(RowMetaInterface rowMeta, Object[] row, StepInterface stepInterface) throws KettleStepException;
 
  /**
   * Which mini-icon needs to be shown on the hop?
   * 
   * @return the available code EImage or null if the standard icon needs to be used.
   */
  public EImage getDistributionImage();

   /**
   * @return The row distribution code (plugin id)
   */
  public String getCode();

  /**
   * @return The row distribution description (plugin description)
   */
  public String getDescription();

  /**
   * Do the actual row distribution in the step
   * @param rowMeta the meta-data of the row to distribute
   * @param row the data of the row data to distribute
   * @param stepInterface The step to distribute the rows in
   * @throws KettleStepException
   */
  public void distributeRow(RowMetaInterface rowMeta, Object[] row, StepInterface stepInterface) throws KettleStepException;

  /**
   * Which mini-icon needs to be shown on the hop?
   *
   * @return the available code EImage or null if the standard icon needs to be used.  
  Return null if you don't want to display an icon.
   */
  public EImage getDistributionImage();

Example

  • No labels