Skip to content

fireflyframework/fireflyframework-eda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

109 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Firefly Framework - Event-Driven Architecture (EDA)

CI License Java Spring Boot

Unified event-driven architecture library with Kafka, RabbitMQ, and Spring Application Events support.


Table of Contents

Overview

Firefly Framework EDA provides a standardized messaging abstraction for event-driven architectures, supporting multiple broker implementations through a unified publisher/consumer API. It enables reactive event publishing and consumption with built-in support for Apache Kafka, RabbitMQ, and Spring Application Events as transport mechanisms.

The library features annotation-driven event publishing (@EventPublisher, @PublishResult), declarative event listeners (@EventListener), and a comprehensive set of event filtering, serialization, and error handling capabilities. It includes support for JSON, Avro, and Protobuf message serialization formats.

The resilient publisher wrapper provides circuit breaker integration, while the dead letter queue handler ensures no events are lost during processing failures. Metrics collection and health indicators provide full observability into the messaging infrastructure.

Features

  • Multi-broker support: Apache Kafka, RabbitMQ, Spring Application Events
  • Annotation-driven publishing: @EventPublisher, @PublishResult
  • Declarative event listening: @EventListener with SpEL-based filtering
  • Event envelope pattern with metadata propagation
  • Pluggable serialization: JSON, Avro, Protobuf
  • Event filtering: type-based, header-based, destination-based, composite
  • Dead letter queue (DLQ) handling for failed messages
  • Resilient publisher with circuit breaker support
  • Dynamic event listener registration at runtime
  • AMQP admin auto-configuration for RabbitMQ exchanges and queues
  • Custom error handling strategies with metrics and notification handlers
  • Health indicators and metrics for Actuator integration
  • Spring Boot auto-configuration for Kafka and RabbitMQ

Requirements

  • Java 21+
  • Spring Boot 3.x
  • Maven 3.9+
  • Apache Kafka or RabbitMQ (depending on chosen broker)

Installation

<dependency>
    <groupId>org.fireflyframework</groupId>
    <artifactId>fireflyframework-eda</artifactId>
    <version>26.02.07</version>
</dependency>

Quick Start

import org.fireflyframework.eda.annotation.EventPublisher;
import org.fireflyframework.eda.annotation.EventListener;
import org.fireflyframework.eda.event.EventEnvelope;

@Service
public class OrderService {

    @EventPublisher(topic = "orders")
    public Mono<OrderCreatedEvent> createOrder(OrderRequest request) {
        // Business logic - return value is automatically published
        return Mono.just(new OrderCreatedEvent(request.getId()));
    }
}

@Component
public class OrderEventHandler {

    @EventListener(topic = "orders")
    public Mono<Void> onOrderCreated(EventEnvelope<OrderCreatedEvent> envelope) {
        // Handle the event
        return processOrder(envelope.getPayload());
    }
}

Configuration

firefly:
  eda:
    broker: kafka  # kafka, rabbitmq, spring
    kafka:
      bootstrap-servers: localhost:9092
      consumer:
        group-id: my-service
    rabbitmq:
      host: localhost
      port: 5672

Documentation

Additional documentation is available in the docs/ directory:

Contributing

Contributions are welcome. Please read the CONTRIBUTING.md guide for details on our code of conduct, development process, and how to submit pull requests.

License

Copyright 2024-2026 Firefly Software Foundation.

Licensed under the Apache License, Version 2.0. See LICENSE for details.

About

Event-Driven Architecture library with Kafka and RabbitMQ publishers/consumers, dead-letter queues, event filtering, and Protobuf serialization.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages