https://github.com/satta/balboa-backend-java
🛑 Balboa backend connector for Java
https://github.com/satta/balboa-backend-java
balboa java passive-dns passivedns pdns
Last synced: about 2 months ago
JSON representation
🛑 Balboa backend connector for Java
- Host: GitHub
- URL: https://github.com/satta/balboa-backend-java
- Owner: satta
- License: mit
- Created: 2020-08-02T12:37:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T23:10:23.000Z (over 4 years ago)
- Last Synced: 2025-02-07T19:49:46.107Z (4 months ago)
- Topics: balboa, java, passive-dns, passivedns, pdns
- Language: Java
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
README
# balboa-backend-java

[](https://maven-badges.herokuapp.com/maven-central/com.github.satta/balboa-backend-java)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:```Java
@FunctionalInterface
public interface ObservationStreamConsumer
{
void submit(Observation o) throws IOException;
}public interface InputProcessor {
public abstract void handle(Observation o) throws BalboaException;
public abstract void handle(DumpRequest d) throws BalboaException;
public abstract void handle(BackupRequest b) throws BalboaException;
public abstract void handle(Query q, ObservationStreamConsumer submitResult) throws BalboaException, IOException;
public abstract void close();
}
```Here's the simplest forking server that starts a new processing engine for each new incoming connection and just prints incoming mesages:
```Java
public class Main {
public static void main(String[] args) {
ServerSocket server = new ServerSocket(4242);
do {
Socket socket = server.accept();
new Thread(new BackendWorker(socket, new PrintProcessor())).start();
} while (true);
}
}
```