use of com.questdb.net.ha.JournalServer in project questdb by bluestreak01.
the class SimpleReplicationServerMain method start.
public void start() throws Exception {
JournalConfiguration configuration = new JournalConfigurationBuilder().build(location);
Factory factory = new Factory(configuration, 1000, 1, 0);
JournalServer server = new JournalServer(factory);
JournalWriter<Price> writer = factory.writer(Price.class);
server.publish(writer);
server.start();
System.out.print("Publishing: ");
for (int i = 0; i < 10; i++) {
publishPrice(writer, i < 3 ? 1000000 : 100);
Thread.sleep(TimeUnit.SECONDS.toMillis(2));
System.out.print('.');
}
System.out.println(" [Done]");
}
use of com.questdb.net.ha.JournalServer in project questdb by bluestreak01.
the class SslReplicationServerMain method start.
public void start() throws Exception {
Factory factory = new Factory(location, 1000, 1, 0);
JournalServer server = new JournalServer(new ServerConfig() {
{
getSslConfig().setSecure(true);
try (InputStream is = this.getClass().getResourceAsStream("/keystore/singlekey.ks")) {
getSslConfig().setKeyStore(is, "changeit");
}
}
}, factory);
JournalWriter<Price> writer = factory.writer(Price.class);
server.publish(writer);
server.start();
System.out.print("Publishing: ");
for (int i = 0; i < 10; i++) {
publishPrice(writer, i < 3 ? 1000000 : 100);
Thread.sleep(TimeUnit.SECONDS.toMillis(2));
System.out.print('.');
}
System.out.println(" [Done]");
}
use of com.questdb.net.ha.JournalServer in project questdb by bluestreak01.
the class AuthReplicationServerMain method start.
public void start() throws Exception {
JournalConfiguration configuration = new JournalConfigurationBuilder().build(location);
Factory factory = new Factory(configuration, 1000, 2, 0);
JournalServer server = new JournalServer(factory, (token, requestedKeys) -> "MY SECRET".equals(new String(token, "UTF8")));
JournalWriter<Price> writer = factory.writer(Price.class);
server.publish(writer);
server.start();
System.out.print("Publishing: ");
for (int i = 0; i < 10; i++) {
publishPrice(writer, i < 3 ? 1000000 : 100);
Thread.sleep(TimeUnit.SECONDS.toMillis(2));
System.out.print('.');
}
System.out.println(" [Done]");
}
Aggregations