diff --git a/pom.xml b/pom.xml
index 2be9bbc..b178bfd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,34 +6,37 @@
uk.gov.ons.census
census-rm-caseprocessor
- 1.0-SNAPSHOT
+ 1.0.0-SNAPSHOT
21
21
+ ${java.version}
+
+ 1.0.0
+ 1.0.0
+ UTF-8
docker
- 2025.0.3
- 7.4.8
+ 2025.1.3
+ 8.1.0
- 1.18.30
- 4.0.0
- 2.3.0
- 3.15.4
- 1.10.1
- 7.4
- 5.9
- 1.9.24
+ 3.15.5
+ 1.11.0
+ 9.0
+ 5.12.0
+ 2.0.13
- 3.24.0
- 3.1.1
- 2.43.0
- 1.22.0
- 0.8.11
- 2.23.0
+ 3.28.0
+ 7.26.0
+ 3.6.3
+ 3.10.0
+ 1.36.1
+ 0.8.15
+ 2.50.0
@@ -56,7 +59,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.5.16
+ 4.1.1
@@ -107,17 +110,21 @@
uk.gov.ons.census
census-rm-common-entity-model
- 0.0.3
+ ${census-rm-common-entity-model.version}
uk.gov.ons.census
census-rm-shared-sample-validation
- 0.1.0
+ ${census-rm-shared-sample-validation.version}
org.springframework.boot
spring-boot-starter
+
+ org.springframework.boot
+ spring-boot-starter-jackson
+
org.springframework.boot
spring-boot-starter-integration
@@ -137,21 +144,6 @@
jakarta.xml.bind
jakarta.xml.bind-api
- ${jakarta-xml-bind-api.version}
-
-
- javax.xml.bind
- jaxb-api
- ${javax-jaxb-api.version}
-
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jdk8
org.postgresql
@@ -160,12 +152,11 @@
org.projectlombok
lombok
- ${lombok.version}
provided
io.hypersistence
- hypersistence-utils-hibernate-63
+ hypersistence-utils-hibernate-73
${hypersistence-utils.version}
@@ -186,7 +177,6 @@
org.aspectj
aspectjweaver
- ${aspectjweaver.version}
@@ -195,6 +185,12 @@
spring-boot-starter-test
test
+
+ org.springframework.retry
+ spring-retry
+ ${spring-retry.version}
+
+
@@ -204,8 +200,20 @@
org.apache.maven.plugins
maven-pmd-plugin
${maven-pmd-plugin.version}
+
+
+ net.sourceforge.pmd
+ pmd-core
+ ${pmd.version}
+
+
+ net.sourceforge.pmd
+ pmd-java
+ ${pmd.version}
+
+
- 21
+ ${java.version}
exclude-pmd.properties
3
true
@@ -270,7 +278,6 @@
org.springframework.boot
spring-boot-maven-plugin
- true
uk.gov.ons.census.caseprocessor.Application
@@ -345,11 +352,13 @@
maven-compiler-plugin
- 21
- 21
+ ${maven.compiler.release}
UTF-8
-XDcompilePolicy=simple
+ --should-stop=ifError=FLOW
+
+ -XDaddTypeAnnotationsToSymbol=true
-Xplugin:ErrorProne
diff --git a/src/main/java/uk/gov/ons/census/caseprocessor/Application.java b/src/main/java/uk/gov/ons/census/caseprocessor/Application.java
index 7eef4b5..83b91b2 100644
--- a/src/main/java/uk/gov/ons/census/caseprocessor/Application.java
+++ b/src/main/java/uk/gov/ons/census/caseprocessor/Application.java
@@ -2,7 +2,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.boot.persistence.autoconfigure.EntityScan;
import org.springframework.integration.annotation.IntegrationComponentScan;
@SpringBootApplication
diff --git a/src/main/java/uk/gov/ons/census/caseprocessor/config/DefaultListenerSupport.java b/src/main/java/uk/gov/ons/census/caseprocessor/config/DefaultListenerSupport.java
index fc6adc5..b76ba9d 100644
--- a/src/main/java/uk/gov/ons/census/caseprocessor/config/DefaultListenerSupport.java
+++ b/src/main/java/uk/gov/ons/census/caseprocessor/config/DefaultListenerSupport.java
@@ -4,7 +4,10 @@
import org.springframework.retry.RetryContext;
import org.springframework.retry.RetryListener;
-public class DefaultListenerSupport implements RetryListener {
+/* Bridge both listener contracts so one bean supports migrated runtime wiring and legacy @Retryable
+listeners. */
+public class DefaultListenerSupport
+ implements org.springframework.core.retry.RetryListener, RetryListener {
@Override
public void close(
@@ -15,7 +18,6 @@ public void close(
@Override
public void onError(
RetryContext context, RetryCallback callback, Throwable throwable) {
-
RetryListener.super.onError(context, callback, throwable);
}
diff --git a/src/main/java/uk/gov/ons/census/caseprocessor/config/MessageConsumerConfig.java b/src/main/java/uk/gov/ons/census/caseprocessor/config/MessageConsumerConfig.java
index ac6c45a..596b29c 100644
--- a/src/main/java/uk/gov/ons/census/caseprocessor/config/MessageConsumerConfig.java
+++ b/src/main/java/uk/gov/ons/census/caseprocessor/config/MessageConsumerConfig.java
@@ -5,18 +5,25 @@
import com.google.cloud.spring.pubsub.core.PubSubTemplate;
import com.google.cloud.spring.pubsub.integration.AckMode;
import com.google.cloud.spring.pubsub.integration.inbound.PubSubInboundChannelAdapter;
+import java.time.Duration;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.retry.RetryListener;
+import org.springframework.core.retry.RetryPolicy;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice;
import org.springframework.messaging.MessageChannel;
-import org.springframework.retry.RetryListener;
import uk.gov.ons.census.caseprocessor.messaging.ManagedMessageRecoverer;
@Configuration
public class MessageConsumerConfig {
+ // Spring core retry defaults to maxRetries = 3, i.e. 3 retries after the initial call
+ // (4 total invocations). Pin this to 3 total invocations to preserve the pre-migration
+ // behaviour.
+ private static final int MESSAGE_TOTAL_ATTEMPTS = 3;
+
private final ManagedMessageRecoverer managedMessageRecoverer;
private final PubSubTemplate pubSubTemplate;
@@ -209,6 +216,8 @@ private PubSubInboundChannelAdapter makeAdapter(MessageChannel channel, String s
@Bean
public RequestHandlerRetryAdvice retryAdvice() {
RequestHandlerRetryAdvice requestHandlerRetryAdvice = new RequestHandlerRetryAdvice();
+ requestHandlerRetryAdvice.setRetryPolicy(
+ RetryPolicy.builder().maxRetries(MESSAGE_TOTAL_ATTEMPTS - 1).delay(Duration.ZERO).build());
requestHandlerRetryAdvice.setRecoveryCallback(managedMessageRecoverer);
return requestHandlerRetryAdvice;
}
diff --git a/src/main/java/uk/gov/ons/census/caseprocessor/messaging/ManagedMessageRecoverer.java b/src/main/java/uk/gov/ons/census/caseprocessor/messaging/ManagedMessageRecoverer.java
index cc19ad6..15b5bc7 100644
--- a/src/main/java/uk/gov/ons/census/caseprocessor/messaging/ManagedMessageRecoverer.java
+++ b/src/main/java/uk/gov/ons/census/caseprocessor/messaging/ManagedMessageRecoverer.java
@@ -7,10 +7,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.AttributeAccessor;
+import org.springframework.integration.core.RecoveryCallback;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.MessagingException;
-import org.springframework.retry.RecoveryCallback;
import org.springframework.retry.RetryContext;
import org.springframework.stereotype.Component;
import uk.gov.ons.census.caseprocessor.client.ExceptionManagerClient;
@@ -19,7 +20,8 @@
import uk.gov.ons.census.caseprocessor.utils.HashHelper;
@Component
-public class ManagedMessageRecoverer implements RecoveryCallback