Skip to content

fluid-ecosystem/fluid-builder

Repository files navigation

๐ŸŒŠ Fluid

๐Ÿš€ 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.


โœจ Features

โœ… 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


๐Ÿ“ฆ Getting Started

Build Your Microservice ๐Ÿ› ๏ธ

Create a Fluid.java class:

public class Fluid {
    public static void main(String[] args) throws InterruptedException {
        try {
            for (int i = 0; i < 1000; i++) {
                String key = "key-" + i;
                String message = "Message " + i;
                KafkaMessenger.sendMessage("test-topic1", message);
            }
        } finally {
            System.out.println("Shutting down Kafka producer...");
            KafkaMessenger.shutdown();
        }
        Thread.sleep(50000); // Keep the app alive for a bit
    }
}

Create a Listener Service ๐ŸŽง

public class MessageService {
    @KafkaListener(topic = "test-topic1", groupId = "test-group")
    public void handleMessage1(String message) {
        System.out.println("1-๐Ÿ•’ Received at " + System.currentTimeMillis());
        System.out.println("1-๐Ÿ“ฅ Message: " + message);
    }
    @KafkaListener(topic = "test-topic2", groupId = "test-group")
    public void handleMessage2(String message) {
        System.out.println("2-๐Ÿ•’ Received at " + System.currentTimeMillis());
        System.out.println("2-๐Ÿ“ฅ Message: " + message);
    }
}

Compound Operations

public class MessageService {
    @KafkaListener(topic = "test-topic1", groupId = "test-group")
    public void handleMessage1(String message) {
        System.out.println("1-๐Ÿ•’ Received at " + System.currentTimeMillis());
        System.out.println("1-๐Ÿ“ฅ Message: " + message);
    }

    @KafkaListener(topic = "test-topic2", groupId = "test-group")
    @SendTo(topic = "processed-topic2")
    public String handleMessage2(String message) {
        System.out.println("2-๐Ÿ•’ Received at " + System.currentTimeMillis());
        System.out.println("2-๐Ÿ“ฅ Message: " + message);
        // Forward processed message to another topic
        return "Processed: " + message;
    }

    @KafkaListener(topic = "test-topic3", groupId = "test-group")
    @ShortCircuit(topic = "error-topic3")
    public void handleMessageWithError(String message) {
        if (message.contains("fail")) {
            throw new RuntimeException("Error detected in message!");
        }
        System.out.println("3-๐Ÿ•’ Message: " + message);
    }
}

๐Ÿ› ๏ธ Architecture

[Fluid App] ---> [KafkaMessenger] ---> [Kafka Broker] ---> [KafkaProcessor] ---> [Your Listener]
  • ๐Ÿ”„ Sends and receives messages through Kafka
  • ๐Ÿงฉ Plug-n-play message handlers via @KafkaListener
  • ๐Ÿงต Simple threading and lifecycle controls

๐Ÿ”ฎ Roadmap

  • ๐Ÿงต Async/parallel message handling
  • ๐Ÿ“Š Metrics (Prometheus or Micrometer)
  • ๐Ÿ›‘ Graceful shutdown hooks
  • ๐Ÿ’พ Configuration via fluid.yaml
  • ๐Ÿง  Built-in retry and backoff strategy

๐Ÿค Contributing

PRs are welcome! Open an issue or suggest an improvement โ€” letโ€™s make microservices fun and fast again ๐Ÿงช


๐Ÿ“œ License

MIT License ยฉ 2025 Maifee Ul Asad

About

Fluid: Agile Java 24 microservice framework with Docker, K8s, and Kafka. Fast, scalable, simple.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published