Skip to content

extending event reference for publication#2478

Open
truhacevkir wants to merge 4 commits intomainfrom
extending-event-entity-data-in-eventbridge-reference
Open

extending event reference for publication#2478
truhacevkir wants to merge 4 commits intomainfrom
extending-event-entity-data-in-eventbridge-reference

Conversation

@truhacevkir
Copy link
Collaborator

@truhacevkir truhacevkir commented Feb 19, 2026

Extending EventReference with type, status and identifier

Background

The EventBridge event emitted when an expanded entry is persisted previously only contained topic, uri, and timestamp. Handlers consuming these events had no way to filter on publication type or status at the routing level, meaning every persisted entry was delivered to all subscribers regardless of relevance.

Changes

The event payload has been extended with five additional fields: oldType, newType, oldStatus, newStatus, and identifier.

Before:

{
  "topic": "PublicationService.ExpandedEntry.Persisted",
  "uri": "s3://persistedEntries/resources/019c75d7fbe4-c057dc2e-ad74-4062-a585-380252d40e34.gz"
}

After:

{
  "topic": "PublicationService.ExpandedEntry.Persisted",
  "uri": "s3://persistedEntries/resources/019c75d7fbe4-c057dc2e-ad74-4062-a585-380252d40e34.gz",
  "identifier": "019c75d7fbe4-c057dc2e-ad74-4062-a585-380252d40e34",
  "oldType": "AcademicArticle",
  "newType": "AcademicArticle",
  "oldStatus": "PUBLISHED",
  "newStatus": "PUBLISHED",
  "timestamp": "2026-02-19T12:20:16.363011Z"
}

Impact

By including oldType, newType, oldStatus, newStatus, and identifier in the event, handlers can now filter directly in their EventBridge rule pattern without fetching and inspecting the full expanded document first.

The NVI handler is a prime example — since the vast majority of publications in the system are not NVI-relevant, filtering at the routing level eliminates millions of unnecessary Lambda invocations.

EventBridge rule pattern before:

detail:
  responsePayload:
    topic: ["PublicationService.ExpandedEntry.Persisted"]

EventBridge rule pattern after:

      Events:
        EventBridgeEvent:
          Type: EventBridgeRule
          Properties:
            EventBusName: !Ref EventBusName
            Pattern:
              detail-type:
                - Lambda Function Invocation Result - Success
              detail:
                responsePayload:
                  topic: [ "PublicationService.ExpandedEntry.Persisted" ]
                  $or:
                    - oldType: [ "AcademicCommentary", "AcademicMonograph", "AcademicChapter", "AcademicArticle", "AcademicLiteratureReview" ]
                      oldStatus: [ "PUBLISHED" ]
                    - oldType: [ "AcademicCommentary", "AcademicMonograph", "AcademicChapter", "AcademicArticle", "AcademicLiteratureReview" ]
                      newStatus: [ "PUBLISHED" ]
                    - newType: [ "AcademicCommentary", "AcademicMonograph", "AcademicChapter", "AcademicArticle", "AcademicLiteratureReview" ]
                      oldStatus: [ "PUBLISHED" ]
                    - newType: [ "AcademicCommentary", "AcademicMonograph", "AcademicChapter", "AcademicArticle", "AcademicLiteratureReview" ]
                      newStatus: [ "PUBLISHED" ]

Filtering on both oldType/newType and oldStatus/newStatus ensures the handler captures events where the publication was already NVI-relevant before the update, as well as events where it has become NVI-relevant as a result of the update.

Future possibilities

Should NVI need to implement a deduplication queue by publication identifier, the identifier field is now available in the event and can be leveraged via EventBridge Pipes.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

Test Results

  294 files  +1    294 suites  +1   24m 32s ⏱️ - 2m 22s
9 494 tests +8  9 483 ✅ +8  11 💤 ±0  0 ❌ ±0 
9 969 runs  +8  9 958 ✅ +8  11 💤 ±0  0 ❌ ±0 

Results for commit cd19a4b. ± Comparison against base commit b1be75b.

This pull request removes 205 and adds 54 tests. Note that renamed tests count towards both.
            "composer" : "DtePAk2ZjLw8Lzr",
            "day" : "3syDklZHbnBwWUfV5"
            "day" : "rPHYfsH5VIzz"
            "description" : "Some description"
            "extent" : "GuJRYj8fAOMcQPQSMI"
            "formatted" : "M-2306-7118-7"
            "introduction" : {
            "month" : "agqDekENHtR2Gy",
            "month" : "dmslbxWc3hmaUBQiv",
            "name" : "OVuxPTXnSLd7jcg"
…
no.unit.nva.LiteraryArtsAudioVisualMigrationTest ‑ [1] {
          "type" : "LiteraryArtsAudioVisual",
          "subtype" : "RadioPlay",
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rYgvX1EuiAFLb"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "hJ9lbyvYn0VvE5oYHw",
            "month" : "agqDekENHtR2Gy",
            "day" : "rPHYfsH5VIzz"
          },
          "isbn" : "9780099470434",
          "extent" : 1040853105
        }
no.unit.nva.LiteraryArtsAudioVisualMigrationTest ‑ [2] {
          "type" : "LiteraryArtsAudioVisual",
          "subtype" : "RadioPlay",
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rYgvX1EuiAFLb"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "hJ9lbyvYn0VvE5oYHw",
            "month" : "agqDekENHtR2Gy",
            "day" : "rPHYfsH5VIzz"
          },
          "isbnList" : [ "9780099470434" ],
          "extent" : 1040853105
        }
no.unit.nva.LiteraryArtsAudioVisualMigrationTest ‑ [3] {
          "type" : "LiteraryArtsAudioVisual",
          "subtype" : "RadioPlay",
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rYgvX1EuiAFLb"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "hJ9lbyvYn0VvE5oYHw",
            "month" : "agqDekENHtR2Gy",
            "day" : "rPHYfsH5VIzz"
          },
          "extent" : 1040853105
        }
no.unit.nva.LiteraryArtsAudioVisualMigrationTest ‑ [4] {
          "type" : "LiteraryArtsAudioVisual",
          "subtype" : {            "type" : "Other",
            "description" : "Some description"
          },
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rYgvX1EuiAFLb"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "hJ9lbyvYn0VvE5oYHw",
            "month" : "agqDekENHtR2Gy",
            "day" : "rPHYfsH5VIzz"
          },
          "extent" : 10408…
no.unit.nva.LiteraryArtsAudioVisualMigrationTest ‑ [5] {
          "type" : "LiteraryArtsAudioVisual",
          "subtype" : {
            "type" : "Other"
          },
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rYgvX1EuiAFLb"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "hJ9lbyvYn0VvE5oYHw",
            "month" : "agqDekENHtR2Gy",
            "day" : "rPHYfsH5VIzz"
          },
          "extent" : 1040853105
        }
no.unit.nva.LiteraryArtsMonographMigrationTest ‑ [1] {
          "type" : "LiteraryArtsMonograph",
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rCmadtTtK1WQtRkPEA"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "tqrJ3RsfZm",
            "month" : "dmslbxWc3hmaUBQiv",
            "day" : "3syDklZHbnBwWUfV5"
          },
          "isbn" : "9780099470434",
          "pages" : {
            "type" : "MonographPages",
            "introduction" : {
        …
no.unit.nva.LiteraryArtsMonographMigrationTest ‑ [2] {
          "type" : "LiteraryArtsMonograph",
          "publisher" : {
            "type" : "UnconfirmedPublisher",
            "name" : "rCmadtTtK1WQtRkPEA"
          },
          "publicationDate" : {
            "type" : "PublicationDate",
            "year" : "tqrJ3RsfZm",
            "month" : "dmslbxWc3hmaUBQiv",
            "day" : "3syDklZHbnBwWUfV5"
          },
          "isbnList" : [ "9780099470434" ],
          "pages" : {
            "type" : "MonographPages",
            "introduction" : {
…
no.unit.nva.LiteraryArtsMonographMigrationTest ‑ [3] {
       "isbnList": [
        "9788234709159"
       ],
       "pages": {
        "illustrated": false,
        "type": "MonographPages"
       },
       "publicationDate": {
        "type": "PublicationDate",
        "year": "2020"
       },
       "publisher": {
        "name": "Utgiver",
        "type": "UnconfirmedPublisher"
       },
       "type": "LiteraryArtsMonograph"
      }
no.unit.nva.LiteraryArtsMonographMigrationTest ‑ [4] {
       "pages": {
        "illustrated": false,
        "type": "MonographPages"
       },
       "publicationDate": {
        "type": "PublicationDate",
        "year": "2020"
       },
       "publisher": {
        "name": "Utgiver",
        "type": "UnconfirmedPublisher"
       },
       "type": "LiteraryArtsMonograph"
      }
no.unit.nva.MigrateRoleToRoleObjectTest ‑ [1] {
  "type" : "Contributor",
  "role" : "AcademicCoordinator"
}
…

♻️ This comment has been updated with latest results.

@truhacevkir truhacevkir marked this pull request as ready for review February 19, 2026 14:16
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.

1 participant