public class StreamReplicator extends Object implements AutoCloseable
This class is designed for high-availability scenarios where the same data needs to be written to multiple DolphinDB nodes simultaneously for real-time stream computing.
| Constructor and Description |
|---|
StreamReplicator(List<HostInfo> hosts,
String tableName)
Creates a new StreamReplicator with default configuration.
|
StreamReplicator(List<HostInfo> hosts,
String tableName,
ReplicatorConfig config)
Creates a new StreamReplicator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Waits for all pending data to be written and closes all connections.
|
ReplicatorStatus |
getStatus()
Gets the current status of the replicator.
|
ErrorCodeInfo |
insert(Object... args)
Inserts a row of data into all target nodes using shared queue (memory-efficient).
|
void |
waitForThreadCompletion()
Waits for all pending data to be written to hosts.
|
public StreamReplicator(List<HostInfo> hosts, String tableName, ReplicatorConfig config) throws IOException
hosts - List of target host informationtableName - The name of the table to write toconfig - Configuration for the replicatorIOException - If connection to any host fails during initializationpublic StreamReplicator(List<HostInfo> hosts, String tableName) throws IOException
hosts - List of target host informationtableName - The name of the table to write toIOException - If connection to any host fails during initializationpublic ErrorCodeInfo insert(Object... args)
args - The column values for the row (must match table schema)public ReplicatorStatus getStatus()
public void waitForThreadCompletion()
public void close()
close in interface AutoCloseableCopyright © 2026 DolphinDB. All rights reserved.