Skip to content
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: support ACK/NACK/REQUEUE #127

Merged
merged 5 commits into from
Jun 20, 2024
Merged

Conversation

rustatian
Copy link
Member

@rustatian rustatian commented Jun 18, 2024

Reason for This PR

closes: roadrunner-server/roadrunner#1941
ref: roadrunner-server/roadrunner#1941 (comment)
CC: @shieldz80, @msmakouz

Description of Changes

  • Add three new RR<->PHP jobs payload types: ACK (2), NACK (3), REQUEUE (4).

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]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Summary by CodeRabbit

  • New Features
    • Introduced handling for new job statuses: ACK, NACK, and REQUEUE.
    • Added support for experimental features in the plugin system.
  • Enhancements
    • Improved the Configurer interface with an Experimental() method.
    • Updated the plugin initialization to include an experimental flag.
  • Infrastructure
    • Upgraded golangci/golangci-lint-action in GitHub Actions to v6.0.1.
    • Updated PHP version in GitHub Actions workflow to 8.3 for better compatibility.

Signed-off-by: Valery Piashchynski <[email protected]>
@rustatian rustatian added the enhancement New feature or request label Jun 18, 2024
@rustatian rustatian requested a review from wolfy-j June 18, 2024 12:21
@rustatian rustatian self-assigned this Jun 18, 2024
Copy link
Contributor

coderabbitai bot commented Jun 18, 2024

Walkthrough

The changes introduce error handling improvements and an experimental feature flag in a Golang project. Key updates include adding job requeue functionality with preserved message order, introducing compile-time configuration checks, and applying necessary GitHub workflow updates.

Changes

File(s) Change Summary
protocol/error.go Updated comment for clarity and added requeue function for handling job requeueing.
protocol/handler.go Added ACK, NACK, and REQUEUE constants; updated Handle method to accommodate these new types.
apis.go Added Experimental() method to the Configurer interface to check for experimental features.
listener.go Modified listener function in Plugin to handle p.experimental flag, changing control flow accordingly.
plugin.go Added experimental field in Plugin struct and updated Init method to set this field if experiments are enabled.
.github/.../linters.yml Updated golangci/golangci-lint-action to v6.0.1 and golangci-lint to v1.59.
.github/.../linux.yml Updated PHP version to "8.3" and applied minor formatting adjustments in workflow steps.

Sequence Diagrams

sequenceDiagram
    participant User
    participant Plugin
    participant Configurer
    participant Handler
    User->>Plugin: Init()
    Plugin->>Configurer: cfg.Experimental()
    Configurer-->>Plugin: true/false
    Plugin->>Plugin: Set experimental field
    User->>Handler: Handle(Job)
    Handler->>Handler: Process job
    alt Job needs requeue
        Handler->>Plugin: requeue()
    end
Loading

Assessment against linked issues

Objective (Issue #1941) Addressed Explanation
Introduce functionality to preserve message publication order after requeuing.
Enable an experimental feature toggle in Plugin.
Update RespHandler to support ACK, NACK, and REQUEUE message types.

Poem

A change in RabbitMQ’s care,
Messages requeue in rightful fare,
With ACK, NACK, and REQUEUEs flight,
Our code now handles them just right.
Experiments dance, a feature's hue,
In workflows fresh, we see it through.
New features bloom in code's delight!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rustatian rustatian changed the title chore: support ACK/NACK/REQUEUE feature: support ACK/NACK/REQUEUE Jun 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ebca0b4 and 8cbf165.

Files ignored due to path filters (1)
  • go.work.sum is excluded by !**/*.sum
Files selected for processing (2)
  • protocol/error.go (2 hunks)
  • protocol/handler.go (2 hunks)
Files not reviewed due to errors (1)
  • protocol/error.go (no review received)
Additional comments not posted (2)
protocol/handler.go (2)

19-21: The addition of ACK, NACK, and REQUEUE to the Type enum is correctly implemented using the iota pattern.


82-99: The updated Handle method correctly implements handling for the new ACK, NACK, and REQUEUE types, with appropriate error handling and logging.

Signed-off-by: Valery Piashchynski <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8cbf165 and cd4f13a.

Files selected for processing (3)
  • apis.go (1 hunks)
  • listener.go (1 hunks)
  • plugin.go (2 hunks)
Additional comments not posted (1)
apis.go (1)

43-44: The addition of the Experimental() method to the Configurer interface is appropriate for enabling dynamic checks of experimental features.

rustatian and others added 2 commits June 18, 2024 16:24
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Valery Piashchynski <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cd4f13a and 0f4a93f.

Files selected for processing (1)
  • listener.go (1 hunks)
Additional context used
golangci-lint
listener.go

166-166: expected operand, found 'if' (typecheck)

GitHub Check: Golang-CI (lint)
listener.go

[failure] 166-166:
syntax error: unexpected if, expected expression (typecheck)


[failure] 166-166:
expected operand, found 'if' (typecheck)

Signed-off-by: Valery Piashchynski <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0f4a93f and 475b310.

Files selected for processing (3)
  • .github/workflows/linters.yml (1 hunks)
  • .github/workflows/linux.yml (2 hunks)
  • listener.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/linters.yml
  • .github/workflows/linux.yml
Files skipped from review as they are similar to previous changes (1)
  • listener.go

@rustatian rustatian merged commit 263623f into master Jun 20, 2024
6 checks passed
@rustatian rustatian deleted the feature/add-new-protocol branch June 20, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[💡 FEATURE REQUEST]: preserve message publication order after re-queuing
1 participant