Skip to content

Repository files navigation

balboa-backend-java

Java CIMaven Central

This is a balboa backend connector for Java. It takes care of the boring msgpack deserialization and validation, and provides a pluggable interface for backends to receive input and answer queries.

Interaction with the frontend(s) is done via code implementing the InputProcessor interface, which is called for each incoming message. The methods to be implemented refer to the various message types:

@FunctionalInterfacepublicinterfaceObservationStreamConsumer
{
voidsubmit(Observationo) throwsIOException;
}
publicinterfaceInputProcessor {
publicabstractvoidhandle(Observationo) throwsBalboaException;
publicabstractvoidhandle(DumpRequestd) throwsBalboaException;
publicabstractvoidhandle(BackupRequestb) throwsBalboaException;
publicabstractvoidhandle(Queryq, ObservationStreamConsumersubmitResult) throwsBalboaException, IOException;
publicabstractvoidclose();
}

Here's the simplest forking server that starts a new processing engine for each new incoming connection and just prints incoming mesages:

publicclassMain {
publicstaticvoidmain(String[] args) {
ServerSocketserver = newServerSocket(4242);
do {
Socketsocket = server.accept();
newThread(newBackendWorker(socket, newPrintProcessor())).start();
} while (true);
}
}

About

πŸ›‘ Balboa backend connector for Java

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages