Skip to content

[LFXV2-1194] feat: filter KV consumer to survey-related key prefixes only#8

Merged
andrest50 merged 2 commits intomainfrom
andrest50/events-subjects
Mar 4, 2026
Merged

[LFXV2-1194] feat: filter KV consumer to survey-related key prefixes only#8
andrest50 merged 2 commits intomainfrom
andrest50/events-subjects

Conversation

@andrest50
Copy link
Contributor

@andrest50 andrest50 commented Mar 4, 2026

Summary

  • Replace single wildcard FilterSubject with FilterSubjects (plural) on the JetStream consumer, scoping it server-side to only receive $KV.v1-objects.itx-surveys.> and $KV.v1-objects.itx-survey-responses.> instead of all keys in the v1-objects bucket
  • Remove the EVENT_FILTER_SUBJECT env var — filter subjects are now hardcoded as they are structural to the service

Ticket

LFXV2-1194

Replace single wildcard FilterSubject with FilterSubjects (plural) on the
JetStream consumer, scoping it server-side to only receive
$KV.v1-objects.itx-surveys.> and $KV.v1-objects.itx-survey-responses.>
instead of all keys in the v1-objects bucket. Remove the EVENT_FILTER_SUBJECT
env var as filter subjects are now hardcoded structural to the service.

Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Andres Tobon <andrest2455@gmail.com>
Copilot AI review requested due to automatic review settings March 4, 2026 00:54
Remove EVENT_FILTER_SUBJECT env var from configuration table and clarify
that filtering is now done server-side via hardcoded subject prefixes.

Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Andres Tobon <andrest2455@gmail.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR narrows the JetStream KV consumer scope so the survey service only receives KV updates for survey-related key prefixes, reducing unnecessary event traffic from the broader v1-objects bucket.

Changes:

  • Replace single FilterSubject with multi-subject FilterSubjects in the event processor configuration.
  • Hardcode the consumer subject filters to $KV.v1-objects.itx-surveys.> and $KV.v1-objects.itx-survey-responses.>.
  • Add a debug log when skipping unsupported KV key prefixes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

File Description
internal/infrastructure/eventing/event_config.go Updates eventing config to support multiple JetStream filter subjects.
cmd/survey-api/main.go Removes EVENT_FILTER_SUBJECT config and supplies hardcoded FilterSubjects for the event processor.
cmd/survey-api/eventing/event_processor.go Applies FilterSubjects to the JetStream consumer config (server-side filtering).
cmd/survey-api/eventing/kv_handler.go Adds debug logging when a KV PUT key prefix is not supported.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrest50 andrest50 merged commit 71377a7 into main Mar 4, 2026
4 of 5 checks passed
@andrest50 andrest50 deleted the andrest50/events-subjects branch March 4, 2026 17:05
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.

3 participants