Skip to content
This repository was archived by the owner on Feb 22, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<!-- Firefly Kernel (foundational: exceptions, shared abstractions) -->
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-kernel</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Observability (metrics, tracing, health, structured logging) -->
<dependency>
<groupId>org.fireflyframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.fireflyframework.transactional.saga.composition;

import org.fireflyframework.kernel.exception.FireflyException;

import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -26,7 +28,7 @@
* during composition building, including helpful suggestions for
* resolving the problems.
*/
public class CompositionValidationException extends RuntimeException {
public class CompositionValidationException extends FireflyException {

private final String compositionName;
private final List<ValidationIssue> validationIssues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.fireflyframework.transactional.saga.engine;

import org.fireflyframework.kernel.exception.FireflyException;
import org.fireflyframework.transactional.saga.core.SagaContext;
import org.fireflyframework.transactional.saga.registry.SagaDefinition;
import org.fireflyframework.transactional.saga.registry.StepDefinition;
Expand Down Expand Up @@ -319,7 +320,7 @@ public interface LayerExecutor {
Mono<String> executeStep(String stepId);
}

public static class CircuitBreakerException extends RuntimeException {
public static class CircuitBreakerException extends FireflyException {
public CircuitBreakerException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.fireflyframework.transactional.saga.engine;

import org.fireflyframework.kernel.exception.FireflyException;
import org.fireflyframework.transactional.saga.core.SagaContext;
import org.fireflyframework.transactional.saga.registry.SagaDefinition;
import org.fireflyframework.transactional.saga.registry.StepDefinition;
Expand Down Expand Up @@ -304,7 +305,7 @@ private Object resolveCompensationArg(Method comp, Object input, Object result)
/**
* Exception thrown when compensation fails and the error handler decides to fail the saga.
*/
public static class CompensationFailedException extends RuntimeException {
public static class CompensationFailedException extends FireflyException {
public CompensationFailedException(String message, Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.fireflyframework.transactional.saga.persistence.serialization;

import org.fireflyframework.kernel.exception.FireflyException;
import org.fireflyframework.transactional.saga.persistence.SagaExecutionState;

/**
Expand Down Expand Up @@ -80,7 +81,7 @@ public interface SagaStateSerializer {
/**
* Exception thrown when serialization or deserialization fails.
*/
class SerializationException extends Exception {
class SerializationException extends FireflyException {
public SerializationException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.fireflyframework.transactional.saga.validation;

import org.fireflyframework.kernel.exception.FireflyException;
import org.fireflyframework.transactional.saga.registry.SagaDefinition;
import org.fireflyframework.transactional.saga.registry.SagaRegistry;
import org.fireflyframework.transactional.saga.registry.StepDefinition;
Expand Down Expand Up @@ -284,11 +285,11 @@ public void validateSagaInputsOrThrow(SagaDefinition saga, Object inputs) throws
/**
* Exception thrown when saga validation fails.
*/
public static class SagaValidationException extends Exception {
public static class SagaValidationException extends FireflyException {
public SagaValidationException(String message) {
super(message);
}

public SagaValidationException(String message, Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.fireflyframework.transactional.saga.validation;

import org.fireflyframework.kernel.exception.FireflyException;
import org.fireflyframework.transactional.saga.registry.SagaDefinition;
import org.fireflyframework.transactional.saga.registry.StepDefinition;

Expand Down Expand Up @@ -266,7 +267,7 @@ private static void validateInputRequirements(SagaDefinition saga, Object inputs
/**
* Exception thrown when circular dependencies are detected.
*/
public static class CircularDependencyException extends Exception {
public static class CircularDependencyException extends FireflyException {
public CircularDependencyException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.fireflyframework.transactional.shared.annotations;

import org.fireflyframework.transactional.saga.config.SagaPersistenceAutoConfiguration;
import org.fireflyframework.transactional.saga.config.SagaRedisAutoConfiguration;
import org.fireflyframework.transactional.shared.config.TransactionalEngineConfiguration;
import org.springframework.context.annotation.Import;

Expand All @@ -27,17 +25,26 @@
/**
* Enables the Transactional Engine (Saga orchestrator) components in a Spring application.
* <p>
* Imports {@link org.fireflyframework.transactional.config.TransactionalEngineConfiguration} that wires:
* This annotation imports {@link TransactionalEngineConfiguration} directly so it works
* in both Spring Boot (auto-configuration) and plain Spring contexts
* (e.g. {@code AnnotationConfigApplicationContext}).
* <p>
* Additional conditional configurations (persistence, Redis, composition) are registered via
* {@code META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports}
* and activated automatically in Spring Boot applications.
* <p>
* Components wired by this annotation:
* - {@code SagaRegistry}: scans for @Saga beans and indexes steps
* - {@code SagaEngine}: the in-memory orchestrator
* - {@code SagaEvents}: default implementation {@code SagaLoggerEvents} (override by declaring your own bean)
* - {@code TccEngine}: the TCC coordinator
* - {@code SagaEvents}: default implementation (override by declaring your own bean)
* - {@code StepLoggingAspect}: AOP aspect for additional logging
* - {@code WebClient.Builder}: convenience bean for HTTP clients
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import({TransactionalEngineConfiguration.class, SagaPersistenceAutoConfiguration.class, SagaRedisAutoConfiguration.class})
@Import(TransactionalEngineConfiguration.class)
public @interface EnableTransactionalEngine {
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ public TccEventPublisher tccEventPublisher() {
return new NoOpTccEventPublisher();
}

@Bean
@ConditionalOnMissingBean
public SagaPersistenceProvider sagaPersistenceProvider() {
return new org.fireflyframework.transactional.saga.persistence.impl.InMemorySagaPersistenceProvider();
}

@Bean
@ConditionalOnMissingBean
public TccPersistenceProvider tccPersistenceProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.fireflyframework.transactional.shared.engine.backpressure;

import org.fireflyframework.kernel.exception.FireflyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -254,7 +255,7 @@ public record CircuitBreakerMetrics(
/**
* Exception thrown when circuit breaker is open.
*/
public static class CircuitBreakerException extends RuntimeException {
public static class CircuitBreakerException extends FireflyException {
public CircuitBreakerException(String message) {
super(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.fireflyframework.transactional.shared.config.TransactionalEngineConfiguration
org.fireflyframework.transactional.saga.config.SagaPersistenceAutoConfiguration
org.fireflyframework.transactional.saga.config.SagaRedisAutoConfiguration
org.fireflyframework.transactional.saga.config.SagaCompositionAutoConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.fireflyframework.transactional.saga.core.SagaContext;
import org.fireflyframework.transactional.saga.engine.SagaEngine;
import org.fireflyframework.transactional.saga.engine.StepInputs;
import org.fireflyframework.transactional.saga.config.SagaPersistenceAutoConfiguration;
import org.fireflyframework.transactional.saga.config.SagaRedisAutoConfiguration;
import org.fireflyframework.transactional.shared.annotations.EnableTransactionalEngine;
import org.fireflyframework.transactional.shared.core.StepStatus;
import org.fireflyframework.transactional.saga.persistence.SagaExecutionState;
Expand All @@ -34,6 +36,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
Expand Down Expand Up @@ -101,6 +104,7 @@ static void configureProperties(DynamicPropertyRegistry registry) {

@Configuration
@EnableTransactionalEngine
@Import({SagaPersistenceAutoConfiguration.class, SagaRedisAutoConfiguration.class})
static class TestConfig {

@Bean
Expand Down