Skip to content

Indexes 9: Adds messaging on package events to kafka#1356

Merged
dcookspi merged 3 commits into
index-8-spk-build-fixfrom
index-9-messaging-to-kafka-feature
May 14, 2026
Merged

Indexes 9: Adds messaging on package events to kafka#1356
dcookspi merged 3 commits into
index-8-spk-build-fixfrom
index-9-messaging-to-kafka-feature

Conversation

@dcookspi
Copy link
Copy Markdown
Collaborator

@dcookspi dcookspi commented Apr 20, 2026

This adds configurable messaging support to spk so it can send messages after events.

This adds support for sending message to kafka when these events occur:

  • publishing a package
  • modifiying a package
  • removing a package

This allows a site to have an external messaging system listen for such messages and take appropriate action, e.g. updating the index on a repo after a new package has been published.

This is the 9th of the chained PRs for adding indexes to spk solves:

  1. Indexes 1: Change Package and related traits to not return references to fields #1336
  2. Indexes 2: Add new_unchecked() constructors to spk schema objects #1337
  3. Indexes 3: Adds flatbuffers schema and SolverPackageSpec for indexes to spk #1338
  4. Indexes 4: Adds Indexes for SPK repositories #1339
  5. Indexes 5: Adds spk repo index subcommand for index generation and updates #1340
  6. Indexes 6: Changes version_filter field in index schema #1344
  7. Indexes 7: Adds a lock file around index generation and updates #1354
  8. Indexes 8: Fixes the spk build or mkb crash with indexes enabled #1355
  9. this PR
  10. Indexes 10: Adds index update listeners and Indexer #1363

@dcookspi dcookspi self-assigned this Apr 20, 2026
@dcookspi dcookspi added enhancement New feature or request SPI AOI Area of interest for SPI pr-chain This PR doesn't target the main branch, don't merge! labels Apr 20, 2026
@dcookspi dcookspi requested a review from jrray April 20, 2026 21:57
@dcookspi dcookspi force-pushed the index-9-messaging-to-kafka-feature branch 3 times, most recently from d93a1bd to d7c1234 Compare April 20, 2026 22:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 13.84615% with 56 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spk-storage/src/storage/messaging/kafka.rs 0.00% 50 Missing ⚠️
crates/spk-config/src/config.rs 0.00% 3 Missing ⚠️
crates/spk-storage/src/storage/messaging/mod.rs 75.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

…kafka

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi force-pushed the index-9-messaging-to-kafka-feature branch from 7d7001c to e8a9444 Compare May 1, 2026 18:57
Comment thread crates/spk-config/src/config.rs Outdated
})
.to_string(),
),
Duration::from_secs(0),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timeout is for waiting for room in the producer queue, it should be willing to wait some small amount of time as a form of back-pressure. Better to wait a little than fail aggressively.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've increased this to 4 seconds and made a constant for it for this PR. The next PR (#1363) adds another producer and its send call will need updating too, and at that point I think I'll make the value into a configuration setting.

Comment thread cspell.json Outdated
… to 4 secs

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi requested a review from jrray May 11, 2026 19:17

/// The queue timeout for a producer sending a message to a queue.
/// This determines how to long retry for if the producer queue is full.
const PRODUCER_QUEUE_TIMEOUT_S: u64 = 4;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const PRODUCER_QUEUE_TIMEOUT_S: u64 = 4;
const PRODUCER_QUEUE_TIMEOUT: Duration = Duration::from_secs(4);

Safety via types.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this, although it goes away in the next PR (#1363), when it turned into a config value.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi changed the title Indexes 9 - Adds messaging on package events to kafka Indexes 9: Adds messaging on package events to kafka May 12, 2026
@dcookspi dcookspi requested a review from jrray May 12, 2026 22:09
@dcookspi dcookspi merged commit cfe91ed into index-8-spk-build-fix May 14, 2026
10 checks passed
@dcookspi dcookspi deleted the index-9-messaging-to-kafka-feature branch May 14, 2026 19:00
dcookspi added a commit that referenced this pull request May 14, 2026
…afka (#1356)

---------

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
dcookspi added a commit that referenced this pull request May 14, 2026
Implements downstream_build_requirements function for IndexedPackage.

Adds messaging on package events and support for sending message to  kafka (#1356)

---------

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pr-chain This PR doesn't target the main branch, don't merge! SPI AOI Area of interest for SPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants