public class KdbPublisher extends KdbConnection
Provides the ability to publish some data (in either KdbTable or
c.Flip format) to a specific kdb process.
Any instantiation of this class will cause the publisher to run in the current
thread. Use KdbPublisherThread if you need a new thread.
| Modifier and Type | Field and Description |
|---|---|
private static org.joda.time.Duration |
DEFAULT_RESET_CONNECTION_DURATION |
private org.joda.time.DateTime |
lastPublishTime
The time of the last successful publish to the kdb process
|
private static org.slf4j.Logger |
log |
private static String |
PUBLISH_FUNCTION |
private org.joda.time.Duration |
resetConnectionDuration
The maximum amount of time after the last publish / connect allowed before the connection to the kdb
process is reset.
|
reconnectIntervalMs| Constructor and Description |
|---|
KdbPublisher(KdbProcess server) |
KdbPublisher(KdbProcess server,
org.joda.time.Duration resetConnectionDuration)
Generates a new KDB publisher.
|
| Modifier and Type | Method and Description |
|---|---|
Boolean |
publish(KdbTable table)
Allows a table (as an internal
KdbTable to be published to the target KDB process |
List<Boolean> |
publish(List<KdbTable> tables)
Allows a list of tables to be published (in sequence) to the target KDB process
|
Boolean |
publish(String tableName,
c.Flip tableData)
Performs the publish of a
c.Flip table structure to the target KDB process |
close, connect, disconnect, getConnection, getRemoteProcess, isConnected, reconnectprivate static final org.slf4j.Logger log
private static final org.joda.time.Duration DEFAULT_RESET_CONNECTION_DURATION
resetConnectionDurationprivate static final String PUBLISH_FUNCTION
private final org.joda.time.Duration resetConnectionDuration
The maximum amount of time after the last publish / connect allowed before the connection to the kdb process is reset. This is due to socket timeout on the target machine that may not be noticed by the local Java process.
On Linux boxes, /proc/sys/net/ipv4/tcp_keepalive_time will tell you how long a socket
can stay open.
private org.joda.time.DateTime lastPublishTime
public KdbPublisher(KdbProcess server) throws KdbTargetProcessUnavailableException
KdbTargetProcessUnavailableExceptionKdbPublisher(KdbProcess, Duration)public KdbPublisher(KdbProcess server, org.joda.time.Duration resetConnectionDuration) throws KdbTargetProcessUnavailableException
server - The server to connect toresetConnectionDuration - The maximum time allowed between publishes before the connection is reset. If this is
null, DEFAULT_RESET_CONNECTION_DURATION will be usedKdbTargetProcessUnavailableException - If the target KDB process is unavailableKdbConnection.connect(),
resetConnectionDurationpublic List<Boolean> publish(List<KdbTable> tables)
tables - The list of tables to publishpublish(KdbTable)public Boolean publish(KdbTable table)
KdbTable to be published to the target KDB processtable - The table to publishtrue if the publish was successful, false otherwise#publish(String, Flip)public Boolean publish(String tableName, c.Flip tableData)
c.Flip table structure to the target KDB processtableName - The name of the table to publishtableData - The table contentstrue if the publish was successful, false otherwise. NOTE:
The function will also return true if either parameter is nullCopyright © 2017. All rights reserved.