Package com.zendesk.maxwell
Class Maxwell
- java.lang.Object
-
- com.zendesk.maxwell.Maxwell
-
-
Field Summary
Fields Modifier and Type Field Description protected MaxwellConfig
config
protected MaxwellContext
context
protected Replicator
replicator
-
Constructor Summary
Constructors Modifier Constructor Description Maxwell(MaxwellConfig config)
Intialize a top level Maxwell runnerprotected
Maxwell(MaxwellContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Position
getInitialPosition()
Determines initial replication position Retrieve stored position from `maxwell`.`positons` Attempt master recovery Use previous client_id's position.String
getMaxwellVersion()
static void
main(String[] args)
The main entry point for Maxwellprotected void
onReplicatorEnd()
Hook for subclasses to execute code before termination of the instanceprotected void
onReplicatorStart()
Hook for subclasses to execute code after all initialization is complete, but before replication starts.void
restart()
restarts a stopped Maxwell instance.void
run()
run Maxwell, catching all Exceptions.void
start()
Start maxwellvoid
terminate()
Stop the currently running Maxwell
-
-
-
Field Detail
-
config
protected MaxwellConfig config
-
context
protected MaxwellContext context
-
replicator
protected Replicator replicator
-
-
Constructor Detail
-
Maxwell
public Maxwell(MaxwellConfig config) throws SQLException, URISyntaxException
Intialize a top level Maxwell runner- Parameters:
config
- Maxwell configuration- Throws:
SQLException
- If Maxwell can't connectURISyntaxException
- If there's a problem with the database configuration
-
Maxwell
protected Maxwell(MaxwellContext context) throws SQLException, URISyntaxException
- Throws:
SQLException
URISyntaxException
-
-
Method Detail
-
restart
public void restart() throws Exception
restarts a stopped Maxwell instance. rebuilds all connections, threads, etc.- Throws:
Exception
- If Maxwell can't initialize its context
-
terminate
public void terminate()
Stop the currently running Maxwell
-
getInitialPosition
protected Position getInitialPosition() throws Exception
Determines initial replication position- Retrieve stored position from `maxwell`.`positons`
- Attempt master recovery
- Use previous client_id's position. See https://github.com/zendesk/maxwell/issues/782
- Capture the current master position
- Returns:
- Binlog position to start replicating at
- Throws:
Exception
- Various SQL and IO exceptions
-
getMaxwellVersion
public String getMaxwellVersion()
-
onReplicatorStart
protected void onReplicatorStart()
Hook for subclasses to execute code after all initialization is complete, but before replication starts.
-
onReplicatorEnd
protected void onReplicatorEnd()
Hook for subclasses to execute code before termination of the instance
-
start
public void start() throws Exception
Start maxwell- Throws:
Exception
- If maxwell stops due to an Exception
-
main
public static void main(String[] args)
The main entry point for Maxwell- Parameters:
args
- command line arguments
-
-