com.continuent.tungsten.replicator.extractor
Interface RawExtractor

All Superinterfaces:
ReplicatorPlugin
All Known Implementing Classes:
CSVLoader, DummyExtractor, JdbcLoader, Loader, MySQLExtractor, MySQLLoader, OracleCDCExtractor, OracleCDCReaderExtractor, OracleExtractor, PostgreSQLSlonyExtractor

public interface RawExtractor
extends ReplicatorPlugin

Denotes an extractor that is responsible for extracting raw events from a database or other replication source. Extractors must be prepared to be interrupted, which mechanism is used to cancel processing.

Version:
1.0
Author:
Teemu Ollakka

Method Summary
 DBMSEvent extract()
          Extract the next available DBMSEvent from the database log.
 DBMSEvent extract(java.lang.String eventId)
          Extract starting after the event ID provided as an argument.
 java.lang.String getCurrentResourceEventId()
          Returns the last event ID committed in the database from which we are extracting.
 void setLastEventId(java.lang.String eventId)
          Set the value of the last event ID we have processed.
 
Methods inherited from interface com.continuent.tungsten.replicator.plugin.ReplicatorPlugin
configure, prepare, release
 

Method Detail

setLastEventId

void setLastEventId(java.lang.String eventId)
                    throws ReplicatorException
Set the value of the last event ID we have processed. The extractor is responsible for returning the next event ID in sequence after this one the next time extract() is called.

Parameters:
eventId - Event ID at which to begin extracting
Throws:
ReplicatorException

extract

DBMSEvent extract()
                  throws ReplicatorException,
                         java.lang.InterruptedException
Extract the next available DBMSEvent from the database log.

Returns:
next DBMSEvent found in the logs
Throws:
ReplicatorException
java.lang.InterruptedException

extract

DBMSEvent extract(java.lang.String eventId)
                  throws ReplicatorException,
                         java.lang.InterruptedException
Extract starting after the event ID provided as an argument. This is equivalent to invoking setLastEventId() followed by extract().

Parameters:
eventId - Event ID at which to begin extracting
Returns:
DBMSEvent corresponding to the id
Throws:
ReplicatorException - Thrown if extractor processing fails
java.lang.InterruptedException - Thrown if the applier is interrupted

getCurrentResourceEventId

java.lang.String getCurrentResourceEventId()
                                           throws ReplicatorException,
                                                  java.lang.InterruptedException
Returns the last event ID committed in the database from which we are extracting. It is used to help synchronize state between the database and the transaction history log. Values returned from this call must correspond with the last extracted DBMSEvent.eventId as follows:
  1. If the returned value is greater than DBMSEvent.eventId, the database has more recent updates
  2. If the returned value is equal to DBMSEvent.eventId, all events have been extracted
It should not be possible to receive a value that is less than the last extracted DBMSEvent.eventId as this implies that the extractor is somehow ahead of the state of the database, which would be inconsistent.

Returns:
A current event ID that can be compared with event IDs in DBMSEvent
Throws:
ReplicatorException
java.lang.InterruptedException