From 4f55e0cd865839e465f2d0cb04b7eb4543a6a2b4 Mon Sep 17 00:00:00 2001 From: Stefan Mirkovic Date: Tue, 10 Mar 2026 16:09:34 +0100 Subject: [PATCH] Upgrade axonserver API usage to 2026.0.0-snapshot ( usage of the consistency marker on appendEvents request) --- pom.xml | 2 +- .../connector/event/AppendEventsTransaction.java | 4 ++-- .../axonserver/connector/event/EventChannel.java | 4 ++-- .../event/impl/AppendEventsTransactionImpl.java | 10 +++++----- .../connector/event/impl/EventChannelImpl.java | 3 ++- .../connector/event/EventHandlingIntegrationTest.java | 6 +++--- .../impl/AxonServerManagedChannelIntegrationTest.java | 4 ++-- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 786a7656..0383e942 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ axoniq https://sonarcloud.io - 2025.2.0 + 2026.0.0-SNAPSHOT 1.76.0 4.34.0 diff --git a/src/main/java/io/axoniq/axonserver/connector/event/AppendEventsTransaction.java b/src/main/java/io/axoniq/axonserver/connector/event/AppendEventsTransaction.java index 67349930..b777cdd6 100644 --- a/src/main/java/io/axoniq/axonserver/connector/event/AppendEventsTransaction.java +++ b/src/main/java/io/axoniq/axonserver/connector/event/AppendEventsTransaction.java @@ -16,7 +16,7 @@ package io.axoniq.axonserver.connector.event; -import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import java.util.concurrent.CompletableFuture; @@ -39,7 +39,7 @@ public interface AppendEventsTransaction { * * @return a CompletableFuture resolving the confirmation of the successful processing of the transaction */ - CompletableFuture commit(); + CompletableFuture commit(); /** * Rolls back the transaction. diff --git a/src/main/java/io/axoniq/axonserver/connector/event/EventChannel.java b/src/main/java/io/axoniq/axonserver/connector/event/EventChannel.java index 03183cf3..21f591ea 100644 --- a/src/main/java/io/axoniq/axonserver/connector/event/EventChannel.java +++ b/src/main/java/io/axoniq/axonserver/connector/event/EventChannel.java @@ -19,9 +19,9 @@ import io.axoniq.axonserver.connector.ResultStream; import io.axoniq.axonserver.grpc.InstructionAck; import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import io.axoniq.axonserver.grpc.streams.CreateResult; -import io.axoniq.axonserver.grpc.streams.CreateStreamResponse; import io.axoniq.axonserver.grpc.streams.StreamStatus; import java.time.Duration; @@ -105,7 +105,7 @@ default CompletableFuture reschedule(String scheduleToken, Duration trig * @return a {@link CompletableFuture} resolving the confirmation of the successful processing of the append * transaction */ - default CompletableFuture appendEvents(Event... events) { + default CompletableFuture appendEvents(Event... events) { AppendEventsTransaction tx = startAppendEventsTransaction(); for (Event event : events) { tx.appendEvent(event); diff --git a/src/main/java/io/axoniq/axonserver/connector/event/impl/AppendEventsTransactionImpl.java b/src/main/java/io/axoniq/axonserver/connector/event/impl/AppendEventsTransactionImpl.java index 879e816f..416ec3de 100644 --- a/src/main/java/io/axoniq/axonserver/connector/event/impl/AppendEventsTransactionImpl.java +++ b/src/main/java/io/axoniq/axonserver/connector/event/impl/AppendEventsTransactionImpl.java @@ -17,7 +17,7 @@ package io.axoniq.axonserver.connector.event.impl; import io.axoniq.axonserver.connector.event.AppendEventsTransaction; -import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import io.grpc.Status; import io.grpc.StatusRuntimeException; @@ -31,16 +31,16 @@ public class AppendEventsTransactionImpl implements AppendEventsTransaction { private final StreamObserver stream; - private final CompletableFuture result; + private final CompletableFuture result; /** * Constructs a {@link AppendEventsTransactionImpl} used to append events to the Event Store. * * @param stream the {@link StreamObserver} of {@link Event} instances which should be appended - * @param result a {@link CompletableFuture} resolving the {@link Confirmation} of the successful processing of this + * @param result a {@link CompletableFuture} resolving the {@link ConfirmationWithConsistencyMarker} of the successful processing of this * transaction */ - public AppendEventsTransactionImpl(StreamObserver stream, CompletableFuture result) { + public AppendEventsTransactionImpl(StreamObserver stream, CompletableFuture result) { this.stream = stream; this.result = result; } @@ -52,7 +52,7 @@ public AppendEventsTransaction appendEvent(Event event) { } @Override - public CompletableFuture commit() { + public CompletableFuture commit() { stream.onCompleted(); return result; } diff --git a/src/main/java/io/axoniq/axonserver/connector/event/impl/EventChannelImpl.java b/src/main/java/io/axoniq/axonserver/connector/event/impl/EventChannelImpl.java index 1f24f2d9..e022fc27 100644 --- a/src/main/java/io/axoniq/axonserver/connector/event/impl/EventChannelImpl.java +++ b/src/main/java/io/axoniq/axonserver/connector/event/impl/EventChannelImpl.java @@ -39,6 +39,7 @@ import io.axoniq.axonserver.grpc.control.ClientIdentification; import io.axoniq.axonserver.grpc.event.CancelScheduledEventRequest; import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import io.axoniq.axonserver.grpc.event.EventSchedulerGrpc; import io.axoniq.axonserver.grpc.event.EventStoreGrpc; @@ -152,7 +153,7 @@ public boolean isReady() { @Override public AppendEventsTransaction startAppendEventsTransaction() { - FutureStreamObserver result = new FutureStreamObserver<>(null); + FutureStreamObserver result = new FutureStreamObserver<>(null); StreamObserver clientStream = eventStore.appendEvent(result); return new AppendEventsTransactionImpl(clientStream, result); } diff --git a/src/test/java/io/axoniq/axonserver/connector/event/EventHandlingIntegrationTest.java b/src/test/java/io/axoniq/axonserver/connector/event/EventHandlingIntegrationTest.java index 1a49e533..036e265a 100644 --- a/src/test/java/io/axoniq/axonserver/connector/event/EventHandlingIntegrationTest.java +++ b/src/test/java/io/axoniq/axonserver/connector/event/EventHandlingIntegrationTest.java @@ -22,7 +22,7 @@ import io.axoniq.axonserver.connector.ResultStream; import io.axoniq.axonserver.connector.impl.StreamClosedException; import io.axoniq.axonserver.grpc.InstructionAck; -import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import io.axoniq.axonserver.grpc.event.EventWithToken; import org.junit.jupiter.api.AfterEach; @@ -103,11 +103,11 @@ void testCallbackNotifiedOfAvailableEvent() throws Exception { CountDownLatch dataAvailable = new CountDownLatch(1); - CompletableFuture result = publishingEventChannel + CompletableFuture result = publishingEventChannel .startAppendEventsTransaction() .appendEvent(createEvent("Hello world")) .commit(); - Confirmation confirmation = result.get(1, SECONDS); + ConfirmationWithConsistencyMarker confirmation = result.get(1, SECONDS); assertTrue(confirmation.getSuccess()); diff --git a/src/test/java/io/axoniq/axonserver/connector/impl/AxonServerManagedChannelIntegrationTest.java b/src/test/java/io/axoniq/axonserver/connector/impl/AxonServerManagedChannelIntegrationTest.java index ba647553..dbf03bcc 100644 --- a/src/test/java/io/axoniq/axonserver/connector/impl/AxonServerManagedChannelIntegrationTest.java +++ b/src/test/java/io/axoniq/axonserver/connector/impl/AxonServerManagedChannelIntegrationTest.java @@ -18,7 +18,7 @@ import io.axoniq.axonserver.connector.AbstractAxonServerIntegrationTest; import io.axoniq.axonserver.grpc.control.ClientIdentification; -import io.axoniq.axonserver.grpc.event.Confirmation; +import io.axoniq.axonserver.grpc.event.ConfirmationWithConsistencyMarker; import io.axoniq.axonserver.grpc.event.Event; import io.axoniq.axonserver.grpc.event.EventStoreGrpc; import io.grpc.ConnectivityState; @@ -170,7 +170,7 @@ void testCallOnDisconnectedChannelFailImmediately() throws IOException { EventStoreGrpc.EventStoreStub stub = EventStoreGrpc.newStub(testSubject); - ClientResponseObserver observer = mock(ClientResponseObserver.class); + ClientResponseObserver observer = mock(ClientResponseObserver.class); StreamObserver upstream = stub.appendEvent(observer); InOrder inOrder = Mockito.inOrder(observer);