https://github.com/okumin/influent
A Fluentd server running on the JVM
https://github.com/okumin/influent
fluentd java
Last synced: 5 months ago
JSON representation
A Fluentd server running on the JVM
- Host: GitHub
- URL: https://github.com/okumin/influent
- Owner: okumin
- License: apache-2.0
- Created: 2016-11-04T15:50:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-16T13:07:52.000Z (about 7 years ago)
- Last Synced: 2025-10-13T12:07:10.102Z (8 months ago)
- Topics: fluentd, java
- Language: Java
- Homepage:
- Size: 300 KB
- Stars: 30
- Watchers: 4
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Influent
[](https://travis-ci.org/okumin/influent)
[](https://maven-badges.herokuapp.com/maven-central/com.okumin/influent-java)
[](http://javadoc-badge.appspot.com/com.okumin/influent-java/index.html)
Influent is a library to implement a Fluentd's forward server on the JVM.
## Protocol
`influent.forward.ForwardServer` is almost compatible with [Forward Protocol Specification v1](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1).
This is the protocol for Fluentd's forward plugin.
* [forward Input Plugin](http://docs.fluentd.org/articles/in_forward)
* [forward Output Plugin](http://docs.fluentd.org/articles/out_forward)
Influent is a server implementation, so behaves as like `in_forward`.
There are some features that Influent does not support now.
See also the `TODO` section.
## Advantages over Fluentd
There are some reasons why Influent is developed.
### Java integration
Influent enables users to handle Fluentd's events by Java.
This means that they can use directly their domain logic written in Java or Java client APIs for some middleware.
### High performance
JVM has high performance and Java has good thread API and IO API.
Influent makes it possible to upgrade performance for some applications.
## TODO
* handshake phase implementation
* CompressedPackedForward mode implementation
* TLS support
* load test and performance improvement
* Scala API
## Usage
### Dependency
#### Maven
```
com.okumin
influent-java
0.3.0
```
### How to use
Give `ForwardServer` the callback function that receives `EventStream`.
If you want to write `EventStreams` to stdout,
```java
// The callback function
ForwardCallback callback = ForwardCallback.ofSyncConsumer(
stream -> System.out.println(stream),
Executors.newFixedThreadPool(1)
);
// Constructs a new server
int port = 24224;
ForwardServer server = new ForwardServer
.Builder(callback)
.localAddress(port)
.build();
// Starts the server on a new thread
server.start();
Thread.sleep(60 * 1000);
// ForwardServer#shutdown returns a CompletableFuture
CompletableFuture stopping = server.shutdown();
// The future will be completed when the server is terminated
stopping.get();
```
Execute the above code, and send a message by `fluent-cat` command.
```
$ echo '{"foo": "bar", "scores": [33, 4]}' | fluent-cat mofu
```
The received `EventStream` is written to stdout.
```
EventStream(Tag(mofu), [EventEntry(2016-11-13T13:10:59Z,{"foo":"bar","scores":[33,4]})])
```