Skip to content

KdbPublisherManager

Jas edited this page Mar 14, 2017 · 1 revision

KdbPublisherManager

This class provides a single interface to publish tables to multiple kdb+ processes at the same time. For example, publishing to a primary and secondary kdb instance.

Configuration

Construction of the publisher manager requires no configuration.

To add processes to publish to, use addPublisher(KdbProcess). This method will check to ensure the target process is not already added and that the process can be connected to. Each publisher added is constructed as a KdbPublisherThread and therefore has a thread assigned to each one.

Usage

You can publish tables in one of two ways:

  • publish(List<KdbTable>): Publishes all specified tables to all configured processes within the manager
  • publish(List<KdbProcess>, List<KdbTable): Publishes all specified tables to the specified processes. Any process passed that is not managed by this manager will result in a KdbPublisherDoesNotExistException

As part of the application shutdown, it is recommended to call shutdown which will gracefully close the connections to all configured processes.

Example

public KdbPublisherManager startManager() throws KdbTargetProcessUnavailableException, KdbPublisherAlreadyExistsException {
    KdbPublisherManager manager = new KdbPublisherManager();
    
    manager.add(new KdbProcess("primary.host", 1234));
    manager.add(new KdbProcess("secondary.host", 1234));

    return manager;
}
Clone this wiki locally