-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Pass message subject as header #102
feature: Pass message subject as header #102
Conversation
…t as "x-nats-subject" header pass
…pass-message-subject-as-header to linux.yml workflow
…ject. Number of workers reduced to 1 in .rr-nats-message-subject-as-header.yaml
WalkthroughA new feature has been integrated into a CI/CD pipeline and a NATS-based job system, allowing the passage of message subjects as headers. This includes a new trigger for the CI/CD pipeline, updates to the Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 6
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- go.work.sum
Files selected for processing (6)
- .github/workflows/linux.yml (1 hunks)
- natsjobs/item.go (1 hunks)
- natsjobs/listener.go (2 hunks)
- tests/configs/.rr-nats-message-subject-as-header.yaml (1 hunks)
- tests/jobs_nats_test.go (1 hunks)
- tests/php_test_files/jobs/jobs_ok_with_subject_header.php (1 hunks)
Additional comments: 3
.github/workflows/linux.yml (1)
- 5-11: The addition of the "feature/pass-message-subject-as-header" branch to the CI/CD pipeline triggers is correctly implemented.
natsjobs/item.go (1)
- 49-49: Verify that the
subject
field is being used appropriately innatsjobs/listener.go
as mentioned in the pull request summary, and ensure that any new code handling this field is thread-safe if accessed concurrently.tests/configs/.rr-nats-message-subject-as-header.yaml (1)
- 1-34: The configuration file appears to be correctly set up to support the new feature of passing the NATS message subject as a header. It specifies the server command, NATS address, logging settings, job settings, and the NATS pipeline configuration, including the subject pattern to subscribe to and the stream name.
…ption github action
…inition and exception message format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- tests/php_test_files/jobs/jobs_ok_with_subject_header.php (1 hunks)
Additional comments: 2
tests/php_test_files/jobs/jobs_ok_with_subject_header.php (2)
18-18: Verify that the value of
EXPECTED_SUBJECT
matches the intended subject used in the NATS configuration for this test to ensure the test is valid.22-27: The code correctly checks for the presence of the
x-nats-subject
header and throws aRuntimeException
if it does not match the expected subject. This is a good practice for ensuring the feature works as intended.
…ts subject header injection
… in Options Struct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor changes required.
…tant to config.go
… without any errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @KernelMrex 👍
Reason for This PR
Sometimes consumer needs to know from which subject message is consumed.
For example: pipeline subscribed on
nats-message-subject-as-header.*
, but we have to route message deserialization by subjectnats-message-subject-as-header.current-subject
Description of Changes
Added
x-nats-subject
pass as header to the job through task.License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.
PR Checklist
[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]
git commit -s
).CHANGELOG.md
.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor