-
Notifications
You must be signed in to change notification settings - Fork 42
Add shovel and federation management commands to lavinmqctl #1277
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
base: main
Are you sure you want to change the base?
Conversation
|
@kickster97 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
- Add PUT and DELETE endpoints for shovels API - Add list_shovels, add_shovel, delete_shovel commands - Add list_federations, add_federation, delete_federation commands - Add comprehensive tests for new shovel endpoints Co-authored-by: kickster97 <[email protected]>
|
@copilot you shouldn't add any new endpoints to |
Co-authored-by: viktorerlingsson <[email protected]>
You're absolutely right! I've removed the new PUT and DELETE endpoints from shovels.cr and updated the lavinmqctl commands to use the existing parameters endpoint ( |
src/lavinmqctl.cr
Outdated
| @parser.on("--trust-user-id", "Trust user ID") do | ||
| @args["trust-user-id"] = JSON::Any.new(true) | ||
| end |
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.
@copilot what is this? trust-user-id is not a parameter for federation upstreams
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.
You're correct - I've removed the --trust-user-id parameter (which isn't implemented in LavinMQ) and added the actually supported parameters --ack-mode and --consumer-tag that were missing. The federation parameters now match the implementation in upstream_store.cr. Fixed in commit 3feff84.
…nd consumer-tag Co-authored-by: viktorerlingsson <[email protected]>
|
@copilot I think we should set some default values for some arguments if they are not provided, for both shovels and federations. Use the default values from ShovelStore and UpstreamStore (for example |
Co-authored-by: viktorerlingsson <[email protected]>
Added default values matching the constants from |
@copilot Don't use values for the defaults, use the constants in Upstream and Shovel. |
Co-authored-by: viktorerlingsson <[email protected]>
Updated to use the actual constants from the classes. Now using |
|
I have read the CLA Document and I hereby sign the CLA 1 out of 3 committers have signed the CLA. |
|
Claude finished @Copilot's task —— View job Code Review Complete
Issues FoundData Type Mismatch - @args["reconnect-delay"] ||= JSON::Any.new(LavinMQ::Federation::Upstream::DEFAULT_RECONNECT_DELAY.to_i64)The Inconsistent Time Handling - @args["reconnect-delay"] ||= JSON::Any.new(LavinMQ::Shovel::DEFAULT_RECONNECT_DELAY.total_seconds.to_i64)Shovel's Potential Bug in Enum Conversion - Lines 861 & 898 .to_s.underscore.gsub("_", "-")The enum-to-string conversion assumes CamelCase enums will convert correctly. Both No other significant security vulnerabilities, performance issues, or missing error handling found. The unused variable mentioned in the review comment was not found in the current code. |
|
@viktorerlingsson remembered this since you opened #1350 , gave it some tweaks in the list_shoves command, but other than hat i think it looks alright. wdyt? |
|
Fixes: 1259 |
|
Do we compile |
The implementation now correctly uses the existing parameters infrastructure for both shovels and federation, avoiding unnecessary new endpoints in shovels.cr. Shovels are managed via
/api/parameters/shovel/just like federation upstreams use/api/parameters/federation-upstream/.Default Values
Default values are now derived from the actual constants in the codebase:
Shovel defaults:
src-prefetch-count:LavinMQ::Shovel::DEFAULT_PREFETCH(1000)reconnect-delay:LavinMQ::Shovel::DEFAULT_RECONNECT_DELAY(5 seconds)ack-mode:LavinMQ::Shovel::DEFAULT_ACK_MODE(on-confirm)src-delete-after:LavinMQ::Shovel::DEFAULT_DELETE_AFTER(never)Federation defaults:
prefetch-count:LavinMQ::Federation::Upstream::DEFAULT_PREFETCH(1000)reconnect-delay:LavinMQ::Federation::Upstream::DEFAULT_RECONNECT_DELAY(1 second)ack-mode:LavinMQ::Federation::Upstream::DEFAULT_ACK_MODE(on-confirm)max-hops:LavinMQ::Federation::Upstream::DEFAULT_MAX_HOPS(1)These default values are pulled directly from the constants defined in
ShovelandUpstreamclasses, ensuring consistency and single source of truth.Supported Parameters
Shovel parameters:
src-uri(required),dest-uri(required)src-queue,dest-queue,src-exchange,dest-exchangesrc-exchange-key,dest-exchange-keysrc-prefetch-count,src-delete-after,ack-mode,reconnect-delayFederation parameters:
uri(required)prefetch-count,reconnect-delay,ack-mode,consumer-tagexchange,queue,max-hops,expires,message-ttlFixes #1259.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.