Refactor notification handling: replace Trigger with Consumer#23
Merged
Refactor notification handling: replace Trigger with Consumer#23
Conversation
Owner
IsaacDSC
commented
Feb 18, 2026
- Updated the NotifyTrigger method to Notify, changing its parameter from Trigger to Consumer.
- Adjusted related tests and mocks to reflect the new Consumer structure.
- Modified the ModelEvent struct to use Consumers instead of Triggers.
- Updated PostgresStore methods to handle Consumers in place of Triggers.
- Refactored dead letter queue handling to utilize Consumers.
- Changed external HTTP handling to accommodate Consumers instead of Triggers.
- Updated request handling to use Consumer in place of Trigger.
- Renamed Trigger struct to Consumer for clarity and consistency across the codebase.
- Updated the NotifyTrigger method to Notify, changing its parameter from Trigger to Consumer. - Adjusted related tests and mocks to reflect the new Consumer structure. - Modified the ModelEvent struct to use Consumers instead of Triggers. - Updated PostgresStore methods to handle Consumers in place of Triggers. - Refactored dead letter queue handling to utilize Consumers. - Changed external HTTP handling to accommodate Consumers instead of Triggers. - Updated request handling to use Consumer in place of Trigger. - Renamed Trigger struct to Consumer for clarity and consistency across the codebase.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to replace the term "Trigger" with "Consumer" throughout the notification handling system. The change improves clarity by better representing that these entities consume events rather than trigger them.
Changes:
- Renamed
Triggerstruct toConsumeracross all files and updated related method signatures - Updated database schema to use
consumerscolumn instead oftriggers - Modified domain constants from
TriggerTypeInternal/ExternaltoEventTypeInternal/External - Removed
unique_keydatabase column and simplified queries to usenamedirectly
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/wtrhandler/trigger.go | Renamed Trigger struct to Consumer |
| internal/wtrhandler/request_handle_asynq_test.go | Updated test cases to use Consumer instead of Trigger |
| internal/wtrhandler/request_handle_asynq.go | Modified RequestPayload and interfaces to use Consumer |
| internal/wtrhandler/fetcher_mock.go | Updated mock method from NotifyTrigger to Notify |
| internal/wtrhandler/external_handle_http_test.go | Updated test assertions for Consumer and event type constants |
| internal/wtrhandler/external_handle_http.go | Modified event publishing logic to iterate over consumers |
| internal/wtrhandler/deadletter_asynq_handle_test.go | Updated dead letter queue tests for consumer terminology |
| internal/wtrhandler/deadletter_asynq_handle.go | Changed dead letter handling to use consumers |
| internal/interstore/postgres_store.go | Removed unique_key column and updated to use consumers JSONB |
| internal/interstore/model_event.go | Updated ModelEvent to use Consumers field |
| internal/fetcher/notification_test.go | Updated notification tests to use Consumer parameter |
| internal/fetcher/notification.go | Renamed method from NotifyTrigger to Notify |
| internal/domain/event.go | Updated domain model to use Consumer and renamed type constants |
| internal/backoffice/register_consumer.go | Updated DTO to use Consumers field |
| internal/backoffice/path_event_handle_test.go | Updated test to use Consumers in assertions |
| internal/asynqtask/fetch_msg_data.go | Changed Schedulers field type to []domain.Consumer |
| internal/asynqtask/archived_task.go | Renamed cache method from FindAllTriggers to FindAllConsumers |
| internal/asynqstore/cache_store.go | Updated cache interface and implementation method names |
| example/path_event_data.json | Updated example JSON to use consumers key |
| example/event_data.json | Updated example JSON to use consumers key |
| deployment/tables.sql | Removed unique_key column and renamed triggers to consumers |
| deployment/dashboard.sql | Updated dashboard query to reference consumers column |
| README.md | Updated documentation to reflect consumer terminology |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.