Skip to content

GH-1971 - Only claim event publications for resubmission that are still failed - #1972

Open
Adrastopoulos wants to merge 1 commit into
spring-projects:mainfrom
Adrastopoulos:gh-1971-resubmission-claim
Open

Adrastopoulos wants to merge 1 commit into
spring-projects:mainfrom
Adrastopoulos:gh-1971-resubmission-claim

Conversation

@Adrastopoulos

Copy link
Copy Markdown

Closes #1971.

markResubmitted(…) now takes the status the caller expects the publication to have, like markAbandoned(…) (#1764). processFailedPublications(…) passes FAILED, and the JDBC, JPA, MongoDB and Neo4j repositories then only claim publications with that status or without one. A publication that a concurrent resubmission has claimed and moved to PROCESSING is no longer claimed a second time. The resubmission of incomplete publications (IncompleteEventPublications, republication on restart) passes null and keeps the previous condition.

On the EventPublicationRepository SPI, markResubmitted(UUID, Instant) becomes markResubmitted(UUID, Instant, Status).

Tests:

  • JDBC, JPA and Neo4j: doesNotResubmitFailedPublicationThatHasBeenConcurrentlyResubmitted() claims a failed publication, marks it processing and claims it again. The Implementations of ApplicationEvent wrongly rewrapped into PayloadApplicationEvent #1565 null status tests now claim with FAILED.
  • MongoDB doesn't implement markProcessing(…), so resubmitsPublicationOnlyIfInExpectedStatus() stores a PROCESSING publication directly, and resubmitsFailedPublicationWithoutStatus() covers a document without status.
  • DefaultEventPublicationRegistryUnitTests: processFailedPublications(…) claims with FAILED.

The new tests fail without the fix. The core, JDBC, JPA, MongoDB and Neo4j modules pass with ./mvnw verify.

…on that are still failed.

FailedEventPublications.resubmit(…) reads failed publications and claims
each one via markResubmitted(…), which only required the publication to
be incomplete and not RESUBMITTED. A publication that a concurrent
resubmission had claimed and moved to PROCESSING could thus be claimed
again, and its listener was invoked a second time.

markResubmitted(…) now takes the status the caller expects the
publication to have, like markAbandoned(…). processFailedPublications(…)
passes FAILED, and the JDBC, JPA, MongoDB and Neo4j repositories then
only claim publications with that status or without one. The
resubmission of incomplete publications passes null and keeps claiming
PUBLISHED and PROCESSING ones.

Signed-off-by: Gabriel Hall <gabriel.hall@cox.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resubmitting failed event publications can claim a publication that a concurrent resubmission is processing

1 participant