spring-cloud-task icon indicating copy to clipboard operation
spring-cloud-task copied to clipboard

Incompatibility with spring-integration-core 7 for single-instance-enabled

Open NathalieOrange opened this issue 3 weeks ago • 0 comments

Upgrading springboot to 4.0.0, I'm in this context:

java 21
springboot 4.0.0
springcloud 2025.1.0
spring dependency management 1.1.7

I encountered issue when I want to restrict task instance using

spring.cloud.task.single-instance-enabled=true

using (as said in documentation)

    implementation("org.springframework.integration:spring-integration-core")
    implementation("org.springframework.integration:spring-integration-jdbc")

It appears that to set the lock, spring integration is performing a new request now using EXPIRED_AFTER:

2025-12-15T16:49:02.305+01:00 DEBUG 71175 --- [demo] [ck-leadership-1] o.s.i.s.l.LockRegistryLeaderInitiator    : Acquiring the lock for LockContext{role=batch-template, id=1, isLeader=false}
2025-12-15T16:49:02.305+01:00 DEBUG 71175 --- [demo] [ck-leadership-1] o.s.jdbc.core.JdbcTemplate               : Executing prepared SQL update
2025-12-15T16:49:02.305+01:00 DEBUG 71175 --- [demo] [ck-leadership-1] o.s.jdbc.core.JdbcTemplate               : Executing prepared SQL statement [UPDATE TASK_LOCK
SET CLIENT_ID=?, EXPIRED_AFTER=?
WHERE REGION=? AND LOCK_KEY=? AND (CLIENT_ID=? OR EXPIRED_AFTER<?)
]

But this exception appears:

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Colonne "EXPIRED_AFTER" non trouvée
Column "EXPIRED_AFTER" not found; SQL statement:
UPDATE TASK_LOCK
SET CLIENT_ID=?, EXPIRED_AFTER=?
WHERE REGION=? AND LOCK_KEY=? AND (CLIENT_ID=? OR EXPIRED_AFTER<?)

Looking for EXPIRED_AFTER in schema, it never exists. For example in h2:

CREATE TABLE TASK_LOCK  (
	LOCK_KEY CHAR(36) NOT NULL,
	REGION VARCHAR(100) NOT NULL,
	CLIENT_ID CHAR(36),
	CREATED_DATE TIMESTAMP(9) NOT NULL,
	constraint LOCK_PK primary key (LOCK_KEY, REGION)
);

You can reproduce the issue using the guide project and activating single instance.

Could you provide a fix ?

NathalieOrange avatar Dec 15 '25 16:12 NathalieOrange