<?xml version="1.0" encoding="UTF-8"?>
<!--
  outbox-publisher — PG-backed transactional outbox publisher.

  Public API:
    - OutboxRecord                 (JPA @Entity, compound PK)
    - OutboxRecordRepository       (Spring Data interface)
    - OutboxPublisher              (@Component, AFTER_COMMIT relay)
    - OutboxPollerWorker           (@Scheduled, SENT transition)
    - OutboxAutoConfiguration      (autoconfig, @ConditionalOnProperty)

  Consumers enable via:
    im2be.outbox.enabled=true

  Cross-refs:
    - ADR-0014 D-1 + D-9 (dual-mode relay)
    - ADR-0002 §3a       (Resilience4j circuit-breaker pattern)
    - .planning/26-stage-b-outbox-parity.md §OQ-5 (metrics + alerts)
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.aim2be</groupId>
        <artifactId>im2be-platform-libs-parent</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </parent>

    <artifactId>outbox-publisher</artifactId>
    <packaging>jar</packaging>
    <name>im2be-platform-libs :: outbox-publisher</name>
    <description>PG-backed transactional outbox publisher (ADR-0014 D-4).</description>

    <properties>
        <!-- Pinned third-party versions (rule 9 — pin explicitly, rule 61 —
             verify against current upstream docs before any bump). -->
        <resilience4j.version>2.2.0</resilience4j.version>
        <shedlock.version>6.0.2</shedlock.version>
        <opentelemetry.version>1.43.0</opentelemetry.version>
        <testcontainers.version>1.20.4</testcontainers.version>
    </properties>

    <dependencies>
        <!-- Spring Boot starters -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <!-- JSR-303 validation for OutboxProperties (R3 finding — fail-fast
             on out-of-range tunables at binding time, before they crash deep
             inside Resilience4j / JPA Pageable). Brings hibernate-validator
             transitively per Spring Boot 3.5.14's managed BOM. -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <!-- Micrometer (provided — consumer brings spring-boot-starter-actuator
             with the runtime impl) -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- OpenTelemetry API (provided — consumer wires its own SDK) -->
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <version>${opentelemetry.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Resilience4j circuit-breaker -->
        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-circuitbreaker</artifactId>
            <version>${resilience4j.version}</version>
        </dependency>

        <!-- ShedLock — distributed lock for the poller -->
        <dependency>
            <groupId>net.javacrumbs.shedlock</groupId>
            <artifactId>shedlock-spring</artifactId>
            <version>${shedlock.version}</version>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.shedlock</groupId>
            <artifactId>shedlock-provider-jdbc-template</artifactId>
            <version>${shedlock.version}</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- OpenTelemetry SDK testing helpers (InMemorySpanExporter) used to
             verify the hot-publish span's outcome attribute reflects the
             ACTUAL post-ack result. Pinned to match opentelemetry-api 1.43.0
             (rule 9 — explicit pin, rule 61 — version verified against
             https://github.com/open-telemetry/opentelemetry-java releases). -->
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk-testing</artifactId>
            <version>${opentelemetry.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
