From 602bebaf4dd59aef7106d1225d9249aa36be8311 Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Mon, 16 Dec 2024 15:49:42 +1100 Subject: [PATCH] fix: subscriptions use actual initial offset (#3773) --- .../java/xyz/block/ftl/java/test/subscriber/Subscriber.java | 2 +- .../java/xyz/block/ftl/deployment/SubscriptionProcessor.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/runner/pubsub/testdata/java/subscriber/src/main/java/xyz/block/ftl/java/test/subscriber/Subscriber.java b/backend/runner/pubsub/testdata/java/subscriber/src/main/java/xyz/block/ftl/java/test/subscriber/Subscriber.java index 8eea7135e1..2148cb3609 100644 --- a/backend/runner/pubsub/testdata/java/subscriber/src/main/java/xyz/block/ftl/java/test/subscriber/Subscriber.java +++ b/backend/runner/pubsub/testdata/java/subscriber/src/main/java/xyz/block/ftl/java/test/subscriber/Subscriber.java @@ -21,7 +21,7 @@ void consume(PubSubEvent event) throws Exception { void consumeFromLatest(PubSubEvent event) throws Exception { } - ConsumeFromLatest + @Subscription(topic = Topic2Topic.class, from = FromOffset.BEGINNING) @Retry(count = 2, minBackoff = "1s", maxBackoff = "1s") public void consumeButFailAndRetry(PubSubEvent event) { throw new RuntimeException("always error: event " + event.getTime()); diff --git a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/SubscriptionProcessor.java b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/SubscriptionProcessor.java index bbf9685a9d..fc0cfd2f22 100644 --- a/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/SubscriptionProcessor.java +++ b/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/SubscriptionProcessor.java @@ -85,9 +85,9 @@ public static SubscriptionAnnotation fromJandex(IndexView indexView, AnnotationI } topicName = annotation.value().asString(); AnnotationValue moduleValue = annotation.value("module"); - AnnotationValue deadLetterValue = annotation.value("deadLetter"); + AnnotationValue deadLetterValue = subscriptions.value("deadLetter"); boolean deadLetter = deadLetterValue != null && !deadLetterValue.asString().isEmpty() && deadLetterValue.asBoolean(); - AnnotationValue from = annotation.value("from"); + AnnotationValue from = subscriptions.value("from"); FromOffset fromOffset = from == null ? FromOffset.LATEST : FromOffset.valueOf(from.asEnum()); return new SubscriptionAnnotation(