[LFXV2-1194] feat: filter KV consumer to survey-related key prefixes only#8
Merged
[LFXV2-1194] feat: filter KV consumer to survey-related key prefixes only#8
Conversation
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>
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>
There was a problem hiding this comment.
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
FilterSubjectwith multi-subjectFilterSubjectsin 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.
mauriciozanettisalomao
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FilterSubjectwithFilterSubjects(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 thev1-objectsbucketEVENT_FILTER_SUBJECTenv var — filter subjects are now hardcoded as they are structural to the serviceTicket
LFXV2-1194