com.continuent.tungsten.replicator.extractor
Interface Extractor

All Superinterfaces:
ReplicatorPlugin
All Known Subinterfaces:
ParallelExtractor
All Known Implementing Classes:
ExtractorWrapper, InMemoryQueueAdapter, ParallelQueueExtractor, RemoteTHLExtractor, THLParallelQueueExtractor, THLStoreExtractor

public interface Extractor
extends ReplicatorPlugin

Denotes an extractor that extracts DBMSReplEvents with full metadata.

Version:
1.0
Author:
Teemu Ollakka

Method Summary
 ReplEvent extract()
          Extract the next available event from the log.
 java.lang.String getCurrentResourceEventId()
          Returns the last event ID committed in a database from which we are extracting.
 boolean hasMoreEvents()
          Returns true if there are additional events that may be read as part of block commit processing.
 void setLastEvent(ReplDBMSHeader header)
          Set the value of the last event called.
 void setLastEventId(java.lang.String eventId)
          Provides a new native event ID that overrides the default value that the extractor would otherwise use.
 
Methods inherited from interface com.continuent.tungsten.replicator.plugin.ReplicatorPlugin
configure, prepare, release
 

Method Detail

setLastEvent

void setLastEvent(ReplDBMSHeader header)
                  throws ReplicatorException
Set the value of the last event called. The extractor is responsible for returning the next event in sequence after this one the next time extract() is called.

Parameters:
header - Last event we extracted
Throws:
ReplicatorException

setLastEventId

void setLastEventId(java.lang.String eventId)
                    throws ReplicatorException
Provides a new native event ID that overrides the default value that the extractor would otherwise use. This call is used to position raw extractors at a specific native event ID in the DBMS log. It can be ignored by other extractors that do not read from a data source.

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

extract

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

Returns:
next ReplDBMSEvent found in the logs or another ReplEvent subclass containing control data
Throws:
ReplicatorException
java.lang.InterruptedException

hasMoreEvents

boolean hasMoreEvents()
Returns true if there are additional events that may be read as part of block commit processing.


getCurrentResourceEventId

java.lang.String getCurrentResourceEventId()
                                           throws ReplicatorException,
                                                  java.lang.InterruptedException
Returns the last event ID committed in a 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 or null if this type of extractor does not extract from a database
Throws:
ReplicatorException
java.lang.InterruptedException