Java 24 microservice framework for Kafka. No build tool: annotate a method, ship your .java files.
2.0K
๐ A tiny but agile microservice framework built in Java 24 with first-class support for Docker ๐ณ, Kubernetes โธ๏ธ, and Kafka ๐จ event streaming. Built for speed, scale, and simplicity.
โ Java 24-powered lightweight core โ ๐ Kafka-based event-driven architecture โ ๐ณ Docker-ready containers โ โธ๏ธ Kubernetes-deployable out of the box โ ๐ Minimal boilerplate, maximum flexibility โ ๐ง DIY microservice stack for builders and hackers โ ๐ 100% open source
No build tool. There is no Maven or Gradle step to ship a service. Your
.java files are copied into the image and compiled at container start.
A service is a Dockerfile, a pom.xml listing your dependencies, and your
Java files. Nothing else.
FROM maifeeulasad/fluid-builder:latest
COPY pom.xml .
COPY *.java .
At container start Fluid downloads the dependencies your pom.xml names,
compiles your sources, finds your listeners, and starts consuming.
Any class with an annotated method is picked up โ the file name does not matter.
public class MessageService {
@KafkaListener(topic = "orders", groupId = "order-processors")
public void handleOrder(String message) {
System.out.println("๐ฅ " + message);
}
}
To write a producer instead of a consumer, supply your own Fluid.java. It
replaces the framework's entry point.
public class Fluid {
public static void main(String[] args) throws InterruptedException {
try {
for (int i = 0; i < 1000; i++) {
KafkaMessenger.sendMessage("orders", "Message " + i);
}
} finally {
KafkaMessenger.shutdown();
}
}
}
@KafkaListener โ the common case@KafkaListener(topic = "orders", groupId = "order-processors")
public void handleOrder(String message) { }
| Attribute | Default | |
|---|---|---|
topic | required | topic to consume |
groupId | required | consumer group to join |
bootstrapServers | inherits | broker address; blank follows BOOTSTRAP_SERVERS |
@KafkaSubscription โ full controlSame job, with batching, dead letter routing, topic creation and consumer
tuning. Use it when you need one of those; @KafkaListener otherwise.
@KafkaSubscription(
topic = "orders",
groupId = "order-processors",
partitions = 5,
batchEnabled = true,
enableDeadLetterQueue = true,
deadLetterTopic = "order-errors",
maxPollRecords = 100
)
public void handleOrder(String message) { }
Some attributes are accepted but not yet honoured โ each is marked not yet honoured in its javadoc, so a setting that does nothing says so rather than pretending.
A method may carry @KafkaListener or @KafkaSubscription, not both:
each drives its own consumer, so the handler would run twice per record.
Startup rejects it.
@SendTo โ forward the result@KafkaListener(topic = "orders", groupId = "order-processors")
@SendTo(topic = "processed-orders")
public String handleOrder(String message) {
return "Processed: " + message;
}
@ShortCircuit โ route failures@KafkaListener(topic = "orders", groupId = "order-processors")
@ShortCircuit(topic = "order-errors")
public void handleOrder(String message) {
if (message.contains("fail")) {
throw new RuntimeException("bad message");
}
}
| Variable | Default | |
|---|---|---|
BOOTSTRAP_SERVERS | kafka:9092 | broker address for everything that does not set one explicitly |
KAFKA_COMPRESSION_TYPE | gzip | producer codec |
gzip is the default because it is the only compressing codec that works
with the dependency set Fluid downloads. snappy, lz4 and zstd need
third-party libraries that kafka-clients does not bundle โ select one and
Fluid tells you which library to add rather than failing later at send time.
[Your Producer] โโโถ KafkaMessenger โโโถ [Kafka Broker] โโโถ MessageConsumer โโโถ [Your Listener]
MessageProducer KafkaProcessor
Run it the way it ships:
java DependencyDownloader.java # populates lib/
java -cp "lib/*" Fluid.java
Run the tests:
mvn test
Maven exists for tests, linting and CI only โ its output is never shipped,
and it compiles the same flat sources in place. See DEVELOPMENT.md.
fluid.yamlPRs are welcome! Open an issue or suggest an improvement โ let's make microservices fun and fast again ๐งช
MIT License ยฉ 2026 Maifee Ul Asad
Content type
Image
Digest
sha256:a8533db4eโฆ
Size
501.5 MB
Last updated
17 days ago
docker pull maifeeulasad/fluid-builder